diff --git a/includes/menu.inc b/includes/menu.inc index c3ba10123eb93b4075587fe9c0f9b95a86630b64..a8df5ba87e27af531a356401ca530be07e9fdc7f 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -1704,10 +1704,12 @@ function menu_local_tasks($level = 0) { $tasks[$item['path']] = $item; } // Find all tabs below the current path. - $path = $router_item['path']; + $path = ($router_item['type'] == MENU_DEFAULT_LOCAL_TASK ? $router_item['tab_parent'] : $router_item['path']); // Tab parenting may skip levels, so the number of parts in the path may not // equal the depth. Thus we use the $depth counter (offset by 1000 for ksort). $depth = 1001; + $actions['count'] = 0; + $actions['output'] = array(); while (isset($children[$path])) { $tabs_current = array(); $actions_current = array(); @@ -1752,8 +1754,8 @@ function menu_local_tasks($level = 0) { $path = $next_path; $tabs[$depth]['count'] = $tab_count; $tabs[$depth]['output'] = $tabs_current; - $actions['count'] = $action_count; - $actions['output'] = $actions_current; + $actions['count'] += $action_count; + $actions['output'] = array_merge($actions['output'], $actions_current); $depth++; } $data['actions'] = $actions; diff --git a/modules/block/block.module b/modules/block/block.module index 19e81f55eaf2bb9096adb7ccf608bfbef682670f..1acda1cd7533fc8293516f1ec6666fb1d8daa8f0 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -127,6 +127,16 @@ function block_menu() { 'access arguments' => array($theme), 'file' => 'block.admin.inc', ); + if ($key != $default_theme) { + $items['admin/structure/block/list/' . $key . '/add'] = array( + 'title' => 'Add block', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('block_add_block_form'), + 'access arguments' => array('administer blocks'), + 'type' => MENU_LOCAL_ACTION, + 'file' => 'block.admin.inc', + ); + } $items['admin/structure/block/demo/' . $key] = array( 'title' => check_plain($theme->info['name']), 'page callback' => 'block_admin_demo', diff --git a/modules/block/block.test b/modules/block/block.test index a3002d0dbdedecec80b18a58a4a914116e892b5c..19f52d970e446b9413b6f5e3f39d829e6ea85f37 100644 --- a/modules/block/block.test +++ b/modules/block/block.test @@ -44,6 +44,12 @@ class BlockTestCase extends DrupalWebTestCase { * Test creating custom block, moving it to a specific region and then deleting it. */ function testCustomBlock() { + // Confirm that the add block link appears on block overview pages. + $this->drupalGet('admin/structure/block'); + $this->assertRaw(l('Add block', 'admin/structure/block/add'), t('Add block link is present on block overview page for default theme.')); + $this->drupalGet('admin/structure/block/list/seven'); + $this->assertRaw(l('Add block', 'admin/structure/block/list/seven/add'), t('Add block link is present on block overview page for non-default theme.')); + // Confirm that hidden regions are not shown as options for block placement // when adding a new block. theme_enable(array('stark'));