API / Minn\Rest / MenuLists

MenuLists final readonly class

Minn\Rest\MenuLists · public/minn/src/Minn/Rest/MenuLists.php · 84 lines

The menus and menu items lists, served as the reference serves them: the menus as the nav_menu taxonomy's term list (its parameters through rest_nav_menu_collection_params, its query through rest_nav_menu_query, counted without the page), the items as the nav_menu_item type's post list with its own parameters (Rest\MenuItemCollectionParams), each in its own shape.

Constants and properties

privateTAXONOMY = 'nav_menu'
privateITEM_TYPE = 'nav_menu_item'
privatereadonly Minn\Rest\PostsController $posts

Promoted from the constructor.

propreadonly Minn\Content\Menus $menus

Promoted from the constructor.

propreadonly Minn\Rest\MenuObject $menuObject

Promoted from the constructor.

propreadonly Minn\Rest\MenuItemObject $itemObject

Promoted from the constructor.

propreadonly Minn\Rest\Caller $caller

Promoted from the constructor.

Public

new__construct(Minn\Rest\PostsController $posts, Minn\Content\Menus $menus, Minn\Rest\MenuObject $menuObject, Minn\Rest\MenuItemObject $itemObject, Minn\Rest\Caller $caller)#
methodmenus(Minn\Http\Request $request): Minn\Http\Response#

The menus: edit context for one who may edit menus, a post's menus only for a menu item the caller may read (an unknown post is a bad parameter), then get_terms, or the post's own terms, as asked.

methoditems(Minn\Http\Request $request): Minn\Http\Response#

The menu items, as the post list of their type: every list parameter honoured, each item in its own shape.

Internals 1

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

privatetermsReadable(Minn\Objects\Post $post, array $objectTypes): bool#

Whether the caller may see a post's menus: the post one of the taxonomy's types, and publicly viewable or one the caller may read.

$objectTypeslist<string>the taxonomy's post types