0

I want to show Login link in the Menu navigation, only for guest User.

clinical_trial.login:
  title: Login
  description: 'Login'
  parent: main
  menu_name: main
  route_name: user.login

This is my Custom Menu links code.

What to add?

0

If you are creating a menu link from a custom module, you can check this

https://www.drupal.org/docs/8/api/routing-system/structure-of-routes

Quoting the documentation:

requirements (required): Determines what must be met in order to grant access to the route. 
    _role: A specific Drupal role, eg. 'anonymous'. 

Alternatively you can use this module: https://www.drupal.org/project/menu_item_visibility "It exposes configurable and extendable visibility settings for menu links."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.