diff --git a/core/modules/menu_link/menu_link.api.php b/core/modules/menu_link/menu_link.api.php index 415b603..9c7a37a 100644 --- a/core/modules/menu_link/menu_link.api.php +++ b/core/modules/menu_link/menu_link.api.php @@ -64,6 +64,13 @@ function hook_menu_link_presave(\Drupal\menu_link\Plugin\Core\Entity\MenuLink $m } } +function hook_translated_menu_link_alter(&$item, $map) { + if ($item['href'] == 'devel/cache/clear') { + $item['localized_options']['query'] = drupal_get_destination(); + } +} + + /** * Inform modules that a menu link has been created. * diff --git a/core/modules/user/user.module b/core/modules/user/user.module index bdf5862..0f8ed6c 100644 --- a/core/modules/user/user.module +++ b/core/modules/user/user.module @@ -1139,6 +1139,16 @@ function user_menu_link_load($menu_links) { } /** + * Implements hook_translated_menu_link_alter(). + */ +function user_translated_menu_link_alter(&$link) { + // Hide the "User account" link for anonymous users. + if ($link['link_path'] == 'user' && $link['module'] == 'system' && !$GLOBALS['user']->uid) { + $link['hidden'] = 1; + } +} + +/** * Implements hook_admin_paths(). */ function user_admin_paths() {