Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.341 diff -u -p -r1.341 menu.inc --- includes/menu.inc 24 Aug 2009 01:49:41 -0000 1.341 +++ includes/menu.inc 25 Aug 2009 05:34:45 -0000 @@ -1262,7 +1262,14 @@ function theme_menu_item_link($link) { $link['localized_options'] = array(); } - return l($link['title'], $link['href'], $link['localized_options']); + $link_text = $link['title']; + + if (!empty($link['active'])) { + $link_text .= ' ' . t('(active tab)') . ''; + $link['localized_options']['html'] = TRUE; + } + + return l($link_text, $link['href'], $link['localized_options']); } /** @@ -1531,7 +1538,7 @@ function menu_local_tasks($level = 0) { if ($item['type'] == MENU_DEFAULT_LOCAL_TASK) { // Find the first parent which is not a default local task or action. for ($p = $item['tab_parent']; $tasks[$p]['type'] == MENU_DEFAULT_LOCAL_TASK; $p = $tasks[$p]['tab_parent']); - $link = theme('menu_item_link', array('href' => $tasks[$p]['href']) + $item); + $link = theme('menu_item_link', array('href' => $tasks[$p]['href'], 'active' => TRUE) + $item); $tabs_current .= theme('menu_local_task', $link, TRUE); $next_path = $item['path']; $tab_count++; @@ -1571,21 +1578,24 @@ function menu_local_tasks($level = 0) { if ($item['type'] == MENU_LOCAL_ACTION) { continue; } + + // Test to see if this is an active task. + $active_task = ($item['path'] == $path) ? TRUE : FALSE; + if ($item['access']) { $count++; if ($item['type'] == MENU_DEFAULT_LOCAL_TASK) { // Find the first parent which is not a default local task. for ($p = $item['tab_parent']; $tasks[$p]['type'] == MENU_DEFAULT_LOCAL_TASK; $p = $tasks[$p]['tab_parent']); - $link = theme('menu_item_link', array('href' => $tasks[$p]['href']) + $item); + $link = theme('menu_item_link', array('href' => $tasks[$p]['href'], 'active' => $active_task) + $item); if ($item['path'] == $router_item['path']) { $root_path = $tasks[$p]['path']; } } else { - $link = theme('menu_item_link', $item); + $link = theme('menu_item_link', array('active' => $active_task) + $item); } - // We check for the active tab. - if ($item['path'] == $path) { + if ($active_task) { $tabs_current .= theme('menu_local_task', $link, TRUE); $next_path = $item['tab_parent']; if (isset($tasks[$next_path])) { Index: modules/node/node.test =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.test,v retrieving revision 1.42 diff -u -p -r1.42 node.test --- modules/node/node.test 25 Aug 2009 02:48:16 -0000 1.42 +++ modules/node/node.test 25 Aug 2009 05:34:46 -0000 @@ -203,9 +203,10 @@ class PageEditTestCase extends DrupalWeb $edit_url = url("node/$node->nid/edit", array('absolute' => TRUE)); $actual_url = $this->getURL(); $this->assertEqual($edit_url, $actual_url, t('On edit page.')); + $edit_link = '' . t('Edit') . ' ' . t('(active tab)') . ''; + $this->assertRaw($edit_link, $edit_link . t('Edit tab is active.')); // Check that the title and body fields are displayed with the correct values. - $this->assertLink(t('Edit'), 0, t('Edit tab found.')); $this->assertFieldByName('title', $edit['title'], t('Title field displayed.')); $this->assertFieldByName($body_key, $edit[$body_key], t('Body field displayed.'));