diff --git a/core/includes/menu.inc b/core/includes/menu.inc index d56c53b..1508004 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -2401,7 +2401,7 @@ function menu_link_get_preferred($path = NULL, $selected_menu = NULL) { if (empty($selected_menu)) { // Use an illegal menu name as the key for the preferred menu link. - $selected_menu = '__preferred__'; + $selected_menu = MENU_PREFERRED_LINK; } if (!isset($preferred_links[$path])) { @@ -2459,9 +2459,9 @@ function menu_link_get_preferred($path = NULL, $selected_menu = NULL) { _menu_translate($candidate_item, $map); if ($candidate_item['access']) { $preferred_links[$path][$menu_name] = $candidate_item; - if (empty($preferred_links[$path]['__preferred__'])) { + if (empty($preferred_links[$path][MENU_PREFERRED_LINK])) { // Store the most specific link. - $preferred_links[$path]['__preferred__'] = $candidate_item; + $preferred_links[$path][MENU_PREFERRED_LINK] = $candidate_item; } } } diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index b10a17a..5a735cc 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -18,6 +18,20 @@ const MENU_MAX_MENU_NAME_LENGTH_UI = 27; /** + * Reserved key to identify the most specific menu link for a given path. + * + * The value of this constant is a hash of the constant name. We use the hash + * so that the reserved key is over 32 characters in length and will not + * collide with allowed menu names: + * @code + * sha1('MENU_PREFERRED_LINK') = 1cf698d64d1aa4b83907cf6ed55db3a7f8e92c91 + * @endcode + * + * @see menu_link_get_preferred() + */ +const MENU_PREFERRED_LINK = '1cf698d64d1aa4b83907cf6ed55db3a7f8e92c91'; + +/** * Implements hook_help(). */ function menu_help($path, $arg) {