diff --git a/core/modules/menu/menu.install b/core/modules/menu/menu.install index 2fee65e..8c0c9fc 100644 --- a/core/modules/menu/menu.install +++ b/core/modules/menu/menu.install @@ -14,6 +14,7 @@ function menu_install() { // Add a link for each custom menu. \Drupal::service('router.builder')->rebuild(); menu_router_rebuild(); + menu_default_links_rebuild(); $system_link = entity_load_multiple_by_properties('menu_link', array('link_path' => 'admin/structure/menu', 'module' => 'system')); $system_link = reset($system_link); diff --git a/core/modules/system/system.api.php b/core/modules/system/system.api.php index 27bb2eb..cccf2be 100644 --- a/core/modules/system/system.api.php +++ b/core/modules/system/system.api.php @@ -491,6 +491,50 @@ function hook_menu_get_item_alter(&$router_item, $path, $original_map) { /** * Define links for menus. * + * @return + * An array of default menu links. Each link has a key corresponding to a + * unique machine name. The corresponding array value is an + * associative array that may contain the following key-value pairs: + * - "link_title": Required. The untranslated title of the menu item. + * with path component substitution as described above. + * - "description": The untranslated description of the link. + * - "route_name": Required. The untranslated title of the menu item. + * - "route_parameters": Required. The untranslated title of the menu item. + * - "link_path": Optional. Generally used for external links. + * - "parent": Optional. The machine name of a link to define hierarchy. + * - "weight": An integer that determines the relative position of items in + * the menu; higher-weighted items sink. Defaults to 0. Menu items with the + * same weight are ordered alphabetically. + * - "menu_name": Optional. Set this to a custom menu if you don't want your + * item to be placed in the default Tools menu. + * - "expanded": Optional. If set to TRUE, and if a menu link is provided for + * this menu item (as a result of other properties), then the menu link is + * always expanded, equivalent to its 'always expanded' checkbox being set + * in the UI. + * - "type": A bitmask of flags describing properties of the menu item. + * Many shortcut bitmasks are provided as constants in menu.inc: + * - MENU_NORMAL_ITEM: Normal menu items show up in the menu tree and can be + * moved/hidden by the administrator. + * - MENU_SUGGESTED_ITEM: Modules may "suggest" menu items that the + * administrator may enable. + * If the "type" element is omitted, MENU_NORMAL_ITEM is assumed. + * - "options": An array of options to be passed to l() when generating a link + * from this menu item. + */ +function hook_default_menu_links() { + +} + +/** + * Alter links for menus. + */ +function hook_default_menu_links_alter(&$links) { + +} + +/** + * Define links for menus. + * * @section sec_menu_link Creating Menu Items * Menu item example of type MENU_NORMAL_ITEM: * @code