API / Minn\Runtime / NavMenu

NavMenu final class

Minn\Runtime\NavMenu · public/minn/src/Minn/Runtime/NavMenu.php · 133 lines

wp_nav_menu()'s menu: the one the arguments name, its items marked for the page in view (MenuItemMarks), walked, wrapped in the container.

Constants and properties

privatestatic array $usedIds

Public

staticmenus(mixed $args = array ( )): mixed#

Every menu (wp_get_nav_menus): the nav_menu terms by name, empty ones too, as wp_get_nav_menus leaves them.

staticmenu(mixed $menu): mixed#

A menu by its term, id, slug or name (wp_get_nav_menu_object), or false, as the filter leaves it.

staticitems(mixed $menu, mixed $args = array ( )): mixed#

A menu's items (wp_get_nav_menu_items), or false for no menu.

staticwalk(mixed $items, mixed $depth, mixed $args): mixed#

A menu's items printed through the walker its arguments name, else the default (walk_nav_menu_tree).

staticlocations(): array#

The menu set for each of the theme's locations (get_nav_menu_locations).

@return array<string, mixed>
staticbuild(object $args): string|false|null#

The whole menu for wp_nav_menu(): resolve, fetch, decorate, walk, wrap, filter. Null when there is no menu (the caller's fallback runs); false when the items filtered away to nothing.

Internals 3

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privatemenuForArgs(object $args): object|false#

The menu the args name: by menu, by assigned location, else the first menu that has items.

privatewrapId(object $menu, object $args): string#

The ul id: the caller's, else menu-{slug}, counted up when the same menu renders twice on a page.

privatecontainer(string $nav, object $args, string $slug): string#

The container wrap, when the args ask for one.