Node Types & Targets
Every item in a navigation tree is backed by a NodeType enum value (page, url, entry, children, passive) or a custom node_type handled by a registered NodeTargetResolverInterface adapter.
The 5 Built-In Node Types
Section titled “The 5 Built-In Node Types”node_type |
Adapter | Key Fields | Behavior |
|---|---|---|---|
page |
PageTargetAdapter |
target_page, override_title, sync_status, url_suffix |
Links to a ProcessWire Page. Automatically tracks title and URL changes across languages and hides itself when sync_status = true and the page is unpublished or trashed. |
url |
UrlTargetAdapter |
custom_url (multi-language), open_new_tab |
Links to any sanitized https://, /relative, #anchor, mailto:, or tel: target. External URLs set $node->isExternal = true. |
entry |
EntryTargetAdapter |
target_entry_type, target_entry_id, url_suffix |
Links to a standalone Entries collection item (kind === 'collection', page_id === 0, depth === 0). Fails closed on internal or unviewable blueprints. |
children |
PageChildrenTargetAdapter |
target_page, children_sort_field, children_sort_dir, children_limit, children_inline |
Dynamically expands child pages of target_page (1 to 100 items) ordered by sort, title, name, created, modified, published, id, random, or any validated custom field. Set children_inline = true to splice children directly into the current level as siblings. |
passive |
PassiveTargetAdapter |
passive_kind (heading, divider, text) |
Renders a non-clickable structural element (<span> for heading/text, <li role="separator"> for divider). Divider nodes cannot have children. |
Canonical target_link Structure
Section titled “Canonical target_link Structure”When creating or updating link nodes programmatically (or via the virtual InputfieldReactLink drawer control), pass canonical target_link arrays. NodePayloadMapper projects them onto indexed node fields automatically:
<?php
declare(strict_types=1);
namespace ProcessWire;
/** @var Navigation $navigation */$navigation = wire()->navigation;
// 1. Page target with anchor suffix$pageNode = $navigation->createNode('main', [ 'title' => 'Destinations', 'icon' => 'compass', 'description' => 'Explore curated 7-day private yacht itineraries.', 'target_link' => [ 'type' => 'page', 'pageId' => 1024, 'query' => '', 'anchor' => 'routes', 'target' => '_self', 'rel' => '', ],]);$navigation->saveNode($pageNode);
// 2. Standalone Entries collection target (use resourceType + resourceId)$entryNode = $navigation->createNode('main', [ 'title' => 'Gulet Blue Horizon', 'target_link' => [ 'type' => 'entry', 'resourceType' => 'yachts', 'resourceId' => '01a24329-26d9-71c7-8ee8-2e6cf3a890f3', 'query' => '', 'anchor' => '', 'target' => '_self', 'rel' => '', ],]);$navigation->saveNode($entryNode);
// 3. External URL, email, or tel target$urlNode = $navigation->createNode('footer', [ 'title' => 'Contact Concierge', 'target_link' => [ 'type' => 'email', 'target' => '_self', 'rel' => '', ],]);$navigation->saveNode($urlNode);Styling, Attributes & Multi-Language Labels
Section titled “Styling, Attributes & Multi-Language Labels”Every navigation node supports:
- Multi-Language
titleanddescription: Stored asEntryLanguageValuewithinheritLanguage: true. Whenoverride_titleisfalseon apageorentrynode andtitleis left blank,TreeBuilderpulls the live localized target title automatically. - Icons (
icon): Choose any vector icon fromNavigation::ADMIN_ICONSand render it as sanitized inline<svg>via$node->iconSvg()orrenderIcons => true. - CSS Classes:
item_classes(applied to<li>) andlink_classes(applied to<a>). - Custom HTML Attributes (
custom_attributes): Key/value pairs validated byNavigationSelectorGuard(id,class,title,target,rel,lang,hreflang,download,aria-*, and safedata-*attributes such asdata-mega="destinations").