Fully Qualified Name: | Laminas\Navigation\Navigation |
Extends: | AbstractContainer |
A simple container class for {@link Laminas\Navigation\Page} pages
Name | Description | Defined By |
---|---|---|
__call() | Magic overload: Proxy calls to finder methods | AbstractContainer |
__construct() | Creates a new navigation container | Navigation |
addPage() | Adds a page to the container | AbstractContainer |
addPages() | Adds several pages at once | AbstractContainer |
count() | Returns number of pages in container | AbstractContainer |
current() | Returns current page | AbstractContainer |
findAllBy() | Returns all child pages matching $property == $value, or an empty array if no pages are found | AbstractContainer |
findBy() | Returns page(s) matching $property == $value | AbstractContainer |
findOneBy() | Returns a child page matching $property == $value, or null if not found | AbstractContainer |
getChildren() | Returns the child container. | AbstractContainer |
getPages() | Returns pages in the container | AbstractContainer |
hasChildren() | Proxy to hasPages() | AbstractContainer |
hasPage() | Checks if the container has the given page | AbstractContainer |
hasPages() | Returns true if container contains any pages | AbstractContainer |
key() | Returns hash code of current page | AbstractContainer |
next() | Moves index pointer to next page in the container | AbstractContainer |
notifyOrderUpdated() | Notifies container that the order of pages are updated | AbstractContainer |
removePage() | Removes the given page from the container | AbstractContainer |
removePages() | Removes all pages in container | AbstractContainer |
rewind() | Sets index pointer to first page in the container | AbstractContainer |
setPages() | Sets pages this container should have, removing existing pages | AbstractContainer |
toArray() | Returns an array representation of all pages in container | AbstractContainer |
valid() | Checks if container index is valid | AbstractContainer |
Magic overload: Proxy calls to finder methods
Examples of finder calls:
// METHOD // SAME AS
$nav->findByLabel('foo'); // $nav->findOneBy('label', 'foo');
$nav->findOneByLabel('foo'); // $nav->findOneBy('label', 'foo');
$nav->findAllByClass('foo'); // $nav->findAllBy('class', 'foo');
Parameter Name | Type | Description |
---|---|---|
$method | string | method |
$arguments | array | method |
Returns:
Creates a new navigation container
Parameter Name | Type | Description |
---|---|---|
$pages | array|\Traversable | [optional] |
Returns:
Adds a page to the container
This method will inject the container as the given page's parent by calling {@link Page\AbstractPage::setParent()}.
Parameter Name | Type | Description |
---|---|---|
$page | \Page\AbstractPage|array|\Traversable | page |
Returns: self fluent interface, returns self
Adds several pages at once
Parameter Name | Type | Description |
---|---|---|
$pages | array|\Traversable|\AbstractContainer | pages |
Returns: self fluent interface, returns self
Returns number of pages in container
Implements Countable interface.
Returns: int number of pages in the container
Returns current page
Implements RecursiveIterator interface.
Returns: \Page\AbstractPage current page or null
Returns all child pages matching $property == $value, or an empty array if no pages are found
Parameter Name | Type | Description |
---|---|---|
$property | string | name |
$value | mixed | value |
Returns: array array containing only Page\AbstractPage instances
Returns page(s) matching $property == $value
Parameter Name | Type | Description |
---|---|---|
$property | string | name |
$value | mixed | value |
$all | bool | [optional] |
Returns: \Page\AbstractPage|null matching page or null
Returns a child page matching $property == $value, or null if not found
Parameter Name | Type | Description |
---|---|---|
$property | string | name |
$value | mixed | value |
Returns: \Page\AbstractPage|null matching page or null
Returns the child container.
Implements RecursiveIterator interface.
Returns: \Page\AbstractPage|null
Returns pages in the container
Returns: array array of Page\AbstractPage instances
Proxy to hasPages()
Implements RecursiveIterator interface.
Returns: bool whether container has any pages
Checks if the container has the given page
Parameter Name | Type | Description |
---|---|---|
$page | \Page\AbstractPage | page |
$recursive | bool | [optional] |
Returns: bool whether page is in container
Returns true if container contains any pages
Parameter Name | Type | Description |
---|---|---|
$onlyVisible | bool | whether |
Returns: bool whether container has any pages
Returns hash code of current page
Implements RecursiveIterator interface.
Returns: string hash code of current page
Moves index pointer to next page in the container
Implements RecursiveIterator interface.
Returns: void
Notifies container that the order of pages are updated
Returns: void
Removes the given page from the container
Parameter Name | Type | Description |
---|---|---|
$page | \Page\AbstractPage|int | page |
$recursive | bool | [optional] |
Returns: bool whether the removal was successful
Removes all pages in container
Returns: self fluent interface, returns self
Sets index pointer to first page in the container
Implements RecursiveIterator interface.
Returns: void
Sets pages this container should have, removing existing pages
Parameter Name | Type | Description |
---|---|---|
$pages | array | pages |
Returns: self fluent interface, returns self
Returns an array representation of all pages in container
Returns: array
Checks if container index is valid
Implements RecursiveIterator interface.
Returns: bool