Navigation_Menu implements Registerable, Standard_Service
Protects navigation menu items based on document and category visibility settings.
Tags
Interfaces, Classes and Traits
- Registerable
- Standard_Service
Table of Contents
- protect_nav_menu_items() : array<string|int, mixed>
- Protect navigation menu items based on visibility settings.
- register() : mixed
- {@inheritdoc}
- remove_child_items() : array<string|int, mixed>
- Remove child items of removed parent items.
- should_remove_category_item() : bool
- Determine if a category menu item should be removed.
- should_remove_document_item() : bool
- Determine if a document menu item should be removed.
Methods
protect_nav_menu_items()
Protect navigation menu items based on visibility settings.
public
protect_nav_menu_items(array<string|int, mixed> $menu_items, object $menu, array<string|int, mixed> $args) : array<string|int, mixed>
Handles both category-level and document-level protection in a single pass, including unlock overrides for category protection.
Parameters
- $menu_items : array<string|int, mixed>
-
The menu items.
- $menu : object
-
The menu object.
- $args : array<string|int, mixed>
-
Menu arguments.
Tags
Return values
array<string|int, mixed> —Filtered menu items.
register()
{@inheritdoc}
public
register() : mixed
Tags
Return values
mixed —remove_child_items()
Remove child items of removed parent items.
private
remove_child_items(array<string|int, mixed> $menu_items, array<string|int, mixed> $removed_items) : array<string|int, mixed>
Parameters
- $menu_items : array<string|int, mixed>
-
The menu items.
- $removed_items : array<string|int, mixed>
-
IDs of removed parent items.
Tags
Return values
array<string|int, mixed> —Menu items with children removed.
should_remove_category_item()
Determine if a category menu item should be removed.
private
should_remove_category_item(object $menu_item) : bool
Parameters
- $menu_item : object
-
The menu item.
Tags
Return values
bool —True if the item should be removed.
should_remove_document_item()
Determine if a document menu item should be removed.
private
should_remove_document_item(object $menu_item) : bool
Parameters
- $menu_item : object
-
The menu item.
Tags
Return values
bool —True if the item should be removed.