I want to alter the menu link in Drupal 8. In Drupal 7 we can achieve this using hook_translated_menu_link_alter
function module_translated_menu_link_alter(&$ item, $ map) { global $ user; if (!empty($ item['access'])) { // Administrator will access all menu's. if (strpos(current_path(), 'admin/structure/menu/manage/' . $ item['menu_name']) === 0 && user_access('administer menu')) { return; } // If userid is equal to menu user id. if ($ user->uid == 1) { $ access = 'UNBLOCK'; break; } // Block menu. else { $ access = 'BLOCK'; } // Access FALSE if Menu not for USER. if ($ access == 'BLOCK') { $ item['access'] = FALSE; } } }
In D7 i am hiding/disabling menu based on some conditions like uid.
Similarly I want to alter the menu link in Drupal 8. How can I do it. Thank You.