function user_menu_link_presave

Implements hook_menu_link_presave().

File

drupal/core/modules/user/user.module, line 1033
Enables the user registration and login system.

Code

function user_menu_link_presave(MenuLink $menu_link) {

  // The path 'user' must be accessible for anonymous users, but only visible
  // for authenticated users. Authenticated users should see "My account", but
  // anonymous users should not see it at all. Therefore, invoke
  // user_menu_link_load() to conditionally hide the link.
  if ($menu_link->link_path == 'user' && $menu_link->module == 'system') {
    $menu_link->options['alter'] = TRUE;
  }

  // Force the Logout link to appear on the top-level of 'account' menu by
  // default (i.e., unless it has been customized).
  if ($menu_link->link_path == 'user/logout' && $menu_link->module == 'system' && empty($menu_link->customized)) {
    $menu_link->plid = 0;
  }
}