function ctools_menu_add_tab

Dynamically add a tab to the current path.

This function is a simplified interface for adding tabs to the current path. Some considerations when doing this:

  • First, if there is only 1 tab, Drupal will not show it. Therefore, if you are only adding one tab, you should find a way to make sure there is already tab, or instead add 2.
  • Second, the caller is responsible for providing access control to these links.

Parameters

$link: An array describing this link. It must contain:

  • 'title': The printed title of the link.
  • 'href': The path of the link. This is an argument to l() so it has all of those features and limitations.
  • 'options': Any options that go to l, including query, fragment and html options necessary.
  • 'weight': The weight to use in ordering the tabs.
  • 'type': Optional. If set to MENU_DEFAULT_LOCAL_TASK this can be used to add a fake 'default' local task, which is useful if you have to add tabs to a page that has none.
1 call to ctools_menu_add_tab()
_ctools_menu_add_dynamic_items in includes/menu.inc

File

includes/menu.inc, line 32

Code

function ctools_menu_add_tab($link = NULL) {
    $links =& drupal_static(__FUNCTION__, array());
    if (isset($link)) {
        $links[$link['href']] = $link;
    }
    return $links;
}