hook_menu_insert

function hook_menu_insert

hook_menu_insert($menu)

Respond to a custom menu creation.

This hook is used to notify modules that a custom menu has been created. Contributed modules may use the information to perform actions based on the information entered into the menu system.

Parameters

$menu: An array representing a custom menu:

  • menu_name: The unique name of the custom menu.
  • title: The human readable menu title.
  • description: The custom menu description.

See also

hook_menu_update()

hook_menu_delete()

Related topics

File

modules/menu/menu.api.php, line 29
Hooks provided by the Menu module.

Code

function hook_menu_insert($menu) {
  // For example, we track available menus in a variable.
  $my_menus = variable_get('my_module_menus', array());
  $my_menus[$menu['menu_name']] = $menu['menu_name'];
  variable_set('my_module_menus', $my_menus);
}

© 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/modules!menu!menu.api.php/function/hook_menu_insert/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部