menu_set_active_menu_names

function menu_set_active_menu_names

menu_set_active_menu_names($menu_names = NULL)

Sets (or gets) the active menu for the current page.

The active menu for the page determines the active trail.

Return value

An array of menu machine names, in order of preference. The 'menu_default_active_menus' variable may be used to assert a menu order different from the order of creation, or to prevent a particular menu from being used at all in the active trail. E.g., $conf['menu_default_active_menus'] = array('navigation', 'main-menu')

Related topics

File

includes/menu.inc, line 2321
API for the Drupal menu system.

Code

function menu_set_active_menu_names($menu_names = NULL) {
  $active = &drupal_static(__FUNCTION__);

  if (isset($menu_names) && is_array($menu_names)) {
    $active = $menu_names;
  }
  elseif (!isset($active)) {
    $active = variable_get('menu_default_active_menus', array_keys(menu_list_system_menus()));
  }
  return $active;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!menu.inc/function/menu_set_active_menu_names/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部