Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Zend_Navigation_Container
Container class for Zend_Navigation_Page classes.

bool
$_dirtyIndex= 'false'
Whether index is dirty and needs to be re-arranged
false
Details
array
$_index= 'array()'
An index that contains the order in which to iterate pages
array()
Details
__call(
string $method, array $arguments
)
:
void
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');
Name | Type | Description |
---|---|---|
$method | string | method name |
$arguments | array | method arguments |
Exception | Description |
---|---|
\Zend_Navigation_Exception | if method does not exist |

addPage(
\Zend_Navigation_Page|array|\Zend_Config $page
)
:
\Zend_Navigation_Container
Adds a page to the container
This method will inject the container as the given page's parent by calling {@link Zend_Navigation_Page::setParent()}.
Name | Type | Description |
---|---|---|
$page | \Zend_Navigation_Page|array|\Zend_Config | page to add |
Type | Description |
---|---|
\Zend_Navigation_Container | fluent interface, returns self |
Exception | Description |
---|---|
\Zend_Navigation_Exception | if page is invalid |

addPages(
array|\Zend_Config|\Zend_Navigation_Container $pages
)
:
\Zend_Navigation_Container
Adds several pages at once
Name | Type | Description |
---|---|---|
$pages | array|\Zend_Config|\Zend_Navigation_Container | pages to add |
Type | Description |
---|---|
\Zend_Navigation_Container | fluent interface, returns self |
Exception | Description |
---|---|
\Zend_Navigation_Exception | if $pages is not array, Zend_Config or Zend_Navigation_Container |

count(
)
:
int
Returns number of pages in container
Implements Countable interface.
Type | Description |
---|---|
int | number of pages in the container |

current(
)
:
\Zend_Navigation_Page
Returns current page
Implements RecursiveIterator interface.
Type | Description |
---|---|
\Zend_Navigation_Page | current page or null |
Exception | Description |
---|---|
\Zend_Navigation_Exception | if the index is invalid |

findAllBy(
string $property, mixed $value
)
:
array
Returns all child pages matching $property == $value, or an empty array if no pages are found
Name | Type | Description |
---|---|---|
$property | string | name of property to match against |
$value | mixed | value to match property against |
Type | Description |
---|---|
array | array containing only Zend_Navigation_Page instances |

findBy(
string $property, mixed $value, bool $all
=
false
)
:
\Zend_Navigation_Page|null
Returns page(s) matching $property == $value
Name | Type | Description |
---|---|---|
$property | string | name of property to match against |
$value | mixed | value to match property against |
$all | bool | [optional] whether an array of all matching pages should be returned, or only the first. If true, an array will be returned, even if not matching pages are found. If false, null will be returned if no matching page is found. Default is false. |
Type | Description |
---|---|
\Zend_Navigation_Page|null | matching page or null |

findOneBy(
string $property, mixed $value
)
:
\Zend_Navigation_Page|null
Returns a child page matching $property == $value, or null if not found
Name | Type | Description |
---|---|---|
$property | string | name of property to match against |
$value | mixed | value to match property against |
Type | Description |
---|---|
\Zend_Navigation_Page|null | matching page or null |

getChildren(
)
:
\Zend_Navigation_Page|null
Returns the child container.
Implements RecursiveIterator interface.
Type | Description |
---|---|
\Zend_Navigation_Page|null |

getPages(
)
:
array
Returns pages in the container
Type | Description |
---|---|
array | array of Zend_Navigation_Page instances |

hasChildren(
)
:
bool
Proxy to hasPages()
Implements RecursiveIterator interface.
Type | Description |
---|---|
bool | whether container has any pages |

hasPage(
\Zend_Navigation_Page $page, bool $recursive
=
false
)
:
bool
Checks if the container has the given page
Name | Type | Description |
---|---|---|
$page | \Zend_Navigation_Page | page to look for |
$recursive | bool | [optional] whether to search recursively. Default is false. |
Type | Description |
---|---|
bool | whether page is in container |

hasPages(
)
:
bool
Returns true if container contains any pages
Type | Description |
---|---|
bool | whether container has any pages |

key(
)
:
string
Returns hash code of current page
Implements RecursiveIterator interface.
Type | Description |
---|---|
string | hash code of current page |

next(
)
:
void
Moves index pointer to next page in the container
Implements RecursiveIterator interface.

removePage(
\Zend_Navigation_Page|int $page
)
:
bool
Removes the given page from the container
Name | Type | Description |
---|---|---|
$page | \Zend_Navigation_Page|int | page to remove, either a page instance or a specific page order |
Type | Description |
---|---|
bool | whether the removal was successful |

removePages(
)
:
\Zend_Navigation_Container
Removes all pages in container
Type | Description |
---|---|
\Zend_Navigation_Container | fluent interface, returns self |

rewind(
)
:
void
Sets index pointer to first page in the container
Implements RecursiveIterator interface.

setPages(
array $pages
)
:
\Zend_Navigation_Container
Sets pages this container should have, removing existing pages
Name | Type | Description |
---|---|---|
$pages | array | pages to set |
Type | Description |
---|---|
\Zend_Navigation_Container | fluent interface, returns self |

toArray(
)
:
array
Returns an array representation of all pages in container
Type | Description |
---|---|
array |