Commit aaf9a83d authored by webchick's avatar webchick

#556872 by Davy Van Den Bremt, pwolanin, sun, and eojthebrave: Fixed Action...

#556872 by Davy Van Den Bremt, pwolanin, sun, and eojthebrave: Fixed Action links do not work on all levels (example: 'add block' action link does not appear).
parent f79e4f34
......@@ -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;
......
......@@ -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',
......
......@@ -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'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment