Implements hook_menu_local_tasks().
function custom_block_menu_local_tasks(&$data, $router_item, $root_path) {
// Add the "Add custom block" action link to the theme-specific block library
// listing page.
// @todo This should just be $root_path == 'admin/structure/block/list/%/add'
// but block_menu() registers static router paths instead of dynamic ones.
if (preg_match('@^admin/structure/block/list/(.*)/add$@', $root_path)) {
$item = menu_get_item('block/add');
if ($item['access']) {
$data['actions']['block/add'] = array(
'#theme' => 'menu_local_action',
'#link' => $item,
);
}
}
}