Skip to content

Menus & Dual-Source Schemas

Navigation supports three schema modes (yaml, db, and hybrid) so developers can version-control primary site menus in Git while administrators can still create or tune menus in the ProcessWire Admin.

Defining a YAML Menu (site/navigation/{handle}.yaml)

Section titled “Defining a YAML Menu (site/navigation/{handle}.yaml)”

Create a YAML file named after the menu handle inside site/navigation/ (or register extra directories via $navigation->addPath($dir)). Here is the Aegean Voyages footer schema (site/modules/Navigation/examples/real-world/footer.yaml):

title: "Footer Navigation"
description: "Multi-column Aegean Voyages footer directory and legal links."
icon: layout-columns
maxDepth: 2
cacheTtl: 7200
includeHiddenPages: false
permission: navigation
fields:
column_group:
type: segmented
label: "Footer Column Group"
default: "company"
options:
company: "Company"
fleet: "Services & Fleet"
destinations: "Destinations"
legal: "Legal & Privacy"
columnWidth: 50
rel_nofollow:
type: toggle
label: "Add rel=nofollow"
default: false
columnWidth: 50

When a YAML menu declares fields:, NavigationBlueprints::registerMenuNodeBlueprint() automatically compiles a dedicated navigation-node-{handle} blueprint (such as navigation-node-footer) so those custom fields appear inside the node drawer and are readable in templates via $node->getCustom('column_group').

Each menu maintains its own maxDepth, cache TTL, custom node fields, and independent tree hierarchy.

Editing Menu Settings & Hybrid Overrides (./edit-menu/)

Section titled “Editing Menu Settings & Hybrid Overrides (./edit-menu/)”

Click Actions -> Menu Settings (requires navigation-admin) to open ./edit-menu/?handle={handle} powered by Entries DualSourceRecordEditor (revisions: 10, sluggable: false).

Saving settings on a YAML-defined menu creates a database override (hybrid source) while keeping the YAML custom node fields intact.

Creating a Database-Backed Menu (+ New Menu)

Section titled “Creating a Database-Backed Menu (+ New Menu)”

Click + New Menu in the sidebar (./edit-menu/) or run php vendor/bin/wire make:navigation promo --db to create a database-only menu stored in navigation-menus:

Database-backed menus can be created, revised (up to 10 revisions), and deleted directly in the Admin UI.
Property (YAML / saveMenu()) Default Description
title Required Human display name shown in the workspace sidebar and default aria-label.
handle Filename / slug Normalized lowercase identifier (main, footer, mobile).
description '' Optional editorial note explaining where the menu renders.
icon 'menu-2' Vector icon identifier from Navigation::ADMIN_ICONS.
maxDepth 3 Maximum nesting depth from 1 (flat) up to 10.
cacheTtl 3600 WireCache lifetime in seconds (0 disables caching).
includeHiddenPages false Whether hidden ProcessWire pages remain visible in the resolved tree.
permission '' Optional ProcessWire permission name required to edit items in this menu.
fields [] YAML-only custom Entries field definitions added to navigation-node-{handle}.

Root-Level Mega-Menu Panels (panel_handle)

Section titled “Root-Level Mega-Menu Panels (panel_handle)”

Top-level navigation items (depth === 0) support a panel_handle field populated dynamically via the Navigation::panelOptions hook (for example, attaching a reusable Blocks mega-menu panel to Destinations). Nested items (depth >= 1) always resolve $node->panelHandle === ''.

Next steps