Navigation/Container.php
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Navigation
- Version
- $Id$
\Zend_Navigation_Container
- Implements
- Children
- \Zend_Navigation_Page
- \Zend_Navigation
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties

bool $_dirtyIndex = falsefalseDetails- Type
- bool

array $_index = array()array()Details- Type
- array
Methods

__call(string $method, array $arguments) : mixedMagic overload: Proxy calls to finder methods
// 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');
| Name | Type | Description |
|---|---|---|
| $method | string | method name |
| $arguments | array | method arguments |
| Type | Description |
|---|---|
| mixed | Zend_Navigation|array|null matching page, array of pages or null |
| Exception | Description |
|---|---|
| \Zend_Navigation_Exception | if method does not exist |

addPage(\Zend_Navigation_Page | array | \Zend_Config $page) : \Zend_Navigation_ContainerAdds a page to the container
| 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_ContainerAdds 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() : intReturns number of pages in container
| Type | Description |
|---|---|
| int | number of pages in the container |

current() : \Zend_Navigation_PageReturns current page
| Type | Description |
|---|---|
| \Zend_Navigation_Page | current page or null |
| Exception | Description |
|---|---|
| \Zend_Navigation_Exception | if the index is invalid |

findAllBy(string $property, mixed $value, bool $useRegex = false) : arrayReturns all child pages matching $property == $value or preg_match($value, $property), 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 |
| $useRegex | bool | [optional] if true PHP's preg_match is used. |
| Type | Description |
|---|---|
| array | array containing only Zend_Navigation_Page instances |

findBy(string $property, mixed $value, bool $all = false, bool $useRegex = false) : \Zend_Navigation_Page | nullReturns page(s) matching $property == $value or preg_match($value, $property)
| 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 |
| $useRegex | bool | [optional] if true PHP's preg_match is used. |
| Type | Description |
|---|---|
| \Zend_Navigation_Page | null | matching page or null |

findOneBy(string $property, mixed $value, bool $useRegex = false) : \Zend_Navigation_Page | nullReturns a child page matching $property == $value or preg_match($value, $property), or null if not found
| Name | Type | Description |
|---|---|---|
| $property | string | name of property to match against |
| $value | mixed | value to match property against |
| $useRegex | bool | [optional] if true PHP's preg_match |
| Type | Description |
|---|---|
| \Zend_Navigation_Page | null | matching page or null |

getChildren() : \Zend_Navigation_Page | nullReturns the child container.
| Type | Description |
|---|---|
| \Zend_Navigation_Page | null |

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

hasChildren() : boolProxy to hasPages()
| Type | Description |
|---|---|
| bool | whether container has any pages |

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

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

key() : stringReturns hash code of current page
| Type | Description |
|---|---|
| string | hash code of current page |

next() : voidMoves index pointer to next page in the container

removePage(\Zend_Navigation_Page | int $page) : boolRemoves 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_ContainerRemoves all pages in container
| Type | Description |
|---|---|
| \Zend_Navigation_Container | fluent interface, returns self |

rewind() : voidSets index pointer to first page in the container

setPages(array $pages) : \Zend_Navigation_ContainerSets 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() : arrayReturns an array representation of all pages in container
| Type | Description |
|---|---|
| array |