Thursday, April 23, 2020

Alter menu title hook_alter in drupal 7



1. Alter menu title or add menu item programmatically?
function
YOURTHEMENAME_translated_menu_link_alter(&$item, $map) {
    global $user;
    if ($item['href'] == 'user') {
      $item['title'] = t($user->name);
    }

}

No comments:

Post a Comment

If you have any problem please let me know.