I am new to Drupal and would like to know the details of constant/global variable: $primary_nav Observed this variable is pulling list of links from a Menu with Title : "Main Menu" . I try to see the mapping of these in UI and DB, but could not find. Can you please help me to find out the mapping of this menu Name ( "Main Menu" ) with variable name : primary_nav and where is it defined.

  • Do you use bootstrap theme?
    – MrD
    Jun 6, 2016 at 6:44

1 Answer 1


$primary_nav is template variable in Garland's template.php file. It's a variable specific to this Drupal core theme. The HTML markup is rendered by the theme_links().

The main argument to the theme function is page template variable $main_menu, which is defined in theme.inc. This variable is set by menu_main_menu(), which will retrieve a menu id setting then use that to look up data in the menu_links table (noted by menu_name column).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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