You are viewing beta documentation for Navigation 4.x.
Reference

Menu

A Menu object represents menu-level custom field values for a navigation menu — for example mega-menu content, footer copy, or other data attached to the menu rather than individual nodes. In templates, this is the verbb\navigation\elements\Menu element.

Query

{% set menu = craft.navigation.menu('mainMenu').one() %}

{% if menu %}
    {{ menu.promoHeading }}
{% endif %}

Use craft.navigation.menu() to query menu elements. For batch-loading menus while looping nodes, use withMenu() on node queries.

Properties

Menu elements expose standard Craft element properties (id, title, siteId, etc.) plus any custom fields on the menu field layout.

Methods

MethodDescription
getMenuHandle()Menu handle string

Settings vs element

APIReturnsUse for
craft.navigation.menu('handle').one()Menu elementField values in templates
craft.navigation.getMenuByHandle('handle')Menu elementSame as menu().one() — a shortcut when you already know the handle
Navigation::$plugin->getMenus()->getMenuByHandle('handle')MenuSettings modelCP metadata in PHP — see Menu Settings

GraphQL

Per-menu GraphQL types: {handle}_Menu. See Query Nodes.