Under the "menu" > "settings" navigation tabs there is the option to set primary and secondary links.

  1. Is this strictly for backend or front end?
  2. Can I use these settings for a backend, if so, how get_variables()?
  3. I want to be able to configure custom menus based on roles, I will implement a module to support this but any tips or pointers (API of interest) is greatly appreciated.

Thanks, Alex

  • Regarding "Menu > Settings" , You can able to select

Source for the Main Links (Primary menu)

Select what should be displayed as the Main links (typically at the top of the page).

Secondary links

Select the source menu for the Secondary links.

For example, If you created a new menu called Header Menu and added some links, now you would like to display Header Menu as Main Menu on top of page which is nothing but Primary Links. In that case you have to set "Source for the main links to " Header Menu.

  • Reading these values

Yes, You can able to read these values using below code

$primary_menu = variable_get('menu_main_links_source', 'main-menu')
$secondary_menu = variable_get('menu_secondary_links_source', 'user-menu'),
  • Regarding menus based on roles

You can try using Menu Item Visibility Module

This module exposes configurable and extendable visibility settings for menu links. For example, if you want to create a 'My account' link that points to /user, both anonymous and registered users have access to the /user path, so both will see the link, even if anonymous users do not technically have an account.

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.