Zend_Navigation_Container

Container class for Zend_Navigation_Page classes.

category Zend
package Zend_Navigation
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License

 Methods

Magic overload: Proxy calls to finder methods

__call(string $method, array $arguments) : mixed

Examples of finder calls: // METHOD // SAME AS $nav->findByLabel('foo'); // $nav->findOneBy('label', 'foo'); $nav->findByLabel('/foo/', true); // $nav->findBy('label', '/foo/', true); $nav->findOneByLabel('foo'); // $nav->findOneBy('label', 'foo'); $nav->findAllByClass('foo'); // $nav->findAllBy('class', 'foo');

Parameters

$method

string

method name

$arguments

array

method arguments

Exceptions

\Zend_Navigation_Exception if method does not exist

Returns

mixedZend_Navigation|array|null matching page, array of pages or null

Adds a page to the container

addPage(\Zend_Navigation_Page|array|\Zend_Config $page) : \Zend_Navigation_Container

This method will inject the container as the given page's parent by calling Zend_Navigation_Page::setParent().

Parameters

$page

\Zend_Navigation_Pagearray\Zend_Config

page to add

Exceptions

\Zend_Navigation_Exception if page is invalid

Returns

\Zend_Navigation_Containerfluent interface, returns self

Adds several pages at once

addPages(array<mixed,\Zend_Navigation_Page>|\Zend_Config|\Zend_Navigation_Container $pages) : \Zend_Navigation_Container

Parameters

$pages

array<mixed,\Zend_Navigation_Page>\Zend_Config\Zend_Navigation_Container

pages to add

Exceptions

\Zend_Navigation_Exception if $pages is not array, Zend_Config or Zend_Navigation_Container

Returns

\Zend_Navigation_Containerfluent interface, returns self

Returns number of pages in container

count() : integer

Implements Countable interface.

Returns

integernumber of pages in the container

Returns current page

current() : \Zend_Navigation_Page

Implements RecursiveIterator interface.

Exceptions

\Zend_Navigation_Exception if the index is invalid

Returns

\Zend_Navigation_Pagecurrent page or null

Returns all child pages matching $property == $value or preg_match($value, $property), or an empty array if no pages are found

findAllBy(string $property, mixed $value, boolean $useRegex = false) : array<mixed,\Zend_Navigation_Page>

Parameters

$property

string

name of property to match against

$value

mixed

value to match property against

$useRegex

boolean

[optional] if true PHP's preg_match is used. Default is false.

Returns

array<mixed,\Zend_Navigation_Page>array containing only Zend_Navigation_Page instances

Returns page(s) matching $property == $value or preg_match($value, $property)

findBy(string $property, mixed $value, boolean $all = false, boolean $useRegex = false) : \Zend_Navigation_Page | null

Parameters

$property

string

name of property to match against

$value

mixed

value to match property against

$all

boolean

[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.

$useRegex

boolean

[optional] if true PHP's preg_match is used. Default is false.

Returns

\Zend_Navigation_Pagenullmatching page or null

Returns a child page matching $property == $value or preg_match($value, $property), or null if not found

findOneBy(string $property, mixed $value, boolean $useRegex = false) : \Zend_Navigation_Page | null

Parameters

$property

string

name of property to match against

$value

mixed

value to match property against

$useRegex

boolean

[optional] if true PHP's preg_match is used. Default is false.

Returns

\Zend_Navigation_Pagenullmatching page or null

Returns the child container.

getChildren() : \Zend_Navigation_Page | null

Implements RecursiveIterator interface.

Returns

\Zend_Navigation_Pagenull

Returns pages in the container

getPages() : array<mixed,\Zend_Navigation_Page>

Returns

array<mixed,\Zend_Navigation_Page>array of Zend_Navigation_Page instances

Proxy to hasPages()

hasChildren() : boolean

Implements RecursiveIterator interface.

Returns

booleanwhether container has any pages

Checks if the container has the given page

hasPage(\Zend_Navigation_Page $page, boolean $recursive = false) : boolean

Parameters

$page

\Zend_Navigation_Page

page to look for

$recursive

boolean

[optional] whether to search recursively. Default is false.

Returns

booleanwhether page is in container

Returns true if container contains any pages

hasPages() : boolean

Returns

booleanwhether container has any pages

Returns hash code of current page

key() : string

Implements RecursiveIterator interface.

Returns

stringhash code of current page

Moves index pointer to next page in the container

next() : void

Implements RecursiveIterator interface.

Notifies container that the order of pages are updated

notifyOrderUpdated() : void

Removes the given page from the container

removePage(\Zend_Navigation_Page|integer $page, boolean $recursive = false) : boolean

Parameters

$page

\Zend_Navigation_Pageinteger

page to remove, either a page instance or a specific page order

$recursive

boolean

[optional] whether to remove recursively

Returns

booleanwhether the removal was successful

Removes all pages in container

removePages() : \Zend_Navigation_Container

Returns

\Zend_Navigation_Containerfluent interface, returns self

Sets index pointer to first page in the container

rewind() : void

Implements RecursiveIterator interface.

Sets pages this container should have, removing existing pages

setPages(array<mixed,\Zend_Navigation_Page> $pages) : \Zend_Navigation_Container

Parameters

$pages

array<mixed,\Zend_Navigation_Page>

pages to set

Returns

\Zend_Navigation_Containerfluent interface, returns self

Returns an array representation of all pages in container

toArray() : array<mixed,\Zend_Navigation_Page>

Returns

array<mixed,\Zend_Navigation_Page>

Checks if container index is valid

valid() : boolean

Implements RecursiveIterator interface.

Returns

boolean

Sorts the page index according to page order

_sort() : void

 Properties

 

Whether index is dirty and needs to be re-arranged

$_dirtyIndex : boolean

Default

false
 

An index that contains the order in which to iterate pages

$_index : array

Default

array()
 

Contains sub pages

$_pages : array<mixed,\Zend_Navigation_Page>

Default

array()