Base class for Zend\Navigation\Page pages

AbstractContainer class for Zend\Navigation\Page classes.

 Methods

Magic overload: Proxy calls to finder methods

__call(string $method, array $arguments) 
Inherited

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');

inherited_from \Zend\Navigation\AbstractContainer::__call()

Parameters

$method

string

method name

$arguments

array

method arguments

Exceptions

\Zend\Navigation\Exception\BadMethodCallException if method does not exist

Page constructor

__construct(array | \Traversable $options) 

Parameters

$options

array\Traversable

[optional] page options. Default is null, which should set defaults.

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if invalid options are given

Returns a property, or null if it doesn't exist

__get(string $name) : mixed

Magic overload for enabling

$page->propname

.

Parameters

$name

string

property name

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if property name is invalid

Returns

mixedproperty value or null

Checks if a property is set

__isset(string $name) : bool

Magic overload for enabling

isset($page->propname)

.

Returns true if the property is native (id, class, title, etc), and true or false if it's a custom property (depending on whether the property actually is set).

Parameters

$name

string

property name

Returns

boolwhether the given property exists

Sets a custom property

__set(string $name, mixed $value) : void

Magic overload for enabling

$page->propname = $value

.

Parameters

$name

string

property name

$value

mixed

value to set

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if property name is invalid

Returns page label

__toString() : string

Magic overload for enabling

echo $page

.

Returns

stringpage label

Unsets the given custom property

__unset(string $name) : void

Magic overload for enabling

unset($page->propname)

.

Parameters

$name

string

property name

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if the property is native

Add static factory for self::factory function

addFactory(\Zend\Navigation\Page\callable $callback) 

Parameters

$callback

\Zend\Navigation\Page\callable

Any callable variable

Adds a page to the container

addPage(\Zend\Navigation\Page\AbstractPage | array | \Traversable $page) : \Zend\Navigation\self
Inherited

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

inherited_from \Zend\Navigation\AbstractContainer::addPage()

Parameters

$page

\Zend\Navigation\Page\AbstractPagearray\Traversable

page to add

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if page is invalid

Returns

\Zend\Navigation\selffluent interface, returns self

Adds several pages at once

addPages(array | \Traversable | \Zend\Navigation\AbstractContainer $pages) : \Zend\Navigation\self
Inherited

inherited_from \Zend\Navigation\AbstractContainer::addPages()

Parameters

$pages

array\Traversable\Zend\Navigation\AbstractContainer

pages to add

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if $pages is not array, Traversable or AbstractContainer

Returns

\Zend\Navigation\selffluent interface, returns self

Adds a forward relation to the page

addRel(string $relation, mixed $value) : \Zend\Navigation\Page\AbstractPage

Parameters

$relation

string

relation name (e.g. alternate, glossary, canonical, etc)

$value

mixed

value to set for relation

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Adds a reverse relation to the page

addRev(string $relation, mixed $value) : \Zend\Navigation\Page\AbstractPage

Parameters

$relation

string

relation name (e.g. alternate, glossary, canonical, etc)

$value

mixed

value to set for relation

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Returns number of pages in container

count() : int
Inherited

Implements Countable interface.

inherited_from \Zend\Navigation\AbstractContainer::count()

Returns

intnumber of pages in the container

Returns current page

current() : \Zend\Navigation\Page\AbstractPage
Inherited

Implements RecursiveIterator interface.

inherited_from \Zend\Navigation\AbstractContainer::current()

Exceptions

\Zend\Navigation\Exception\OutOfBoundsException if the index is invalid

Returns

Factory for Zend\Navigation\Page classes

factory(array | \Traversable $options) : \Zend\Navigation\Page\AbstractPage

A specific type to construct can be specified by specifying the key 'type' in $options. If type is 'uri' or 'mvc', the type will be resolved to Zend\Navigation\Page\Uri or Zend\Navigation\Page\Mvc. Any other value for 'type' will be considered the full name of the class to construct. A valid custom page class must extend Zend\Navigation\Page\AbstractPage.

If 'type' is not given, the type of page to construct will be determined by the following rules: - If $options contains either of the keys 'action', 'controller', or 'route', a Zend\Navigation\Page\Mvc page will be created. - If $options contains the key 'uri', a Zend\Navigation\Page\Uri page will be created.

Parameters

$options

array\Traversable

options used for creating page

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if $options is not array/Traversable
\Zend\Navigation\Exception\InvalidArgumentException if 'type' is specified but class not found
\Zend\Navigation\Exception\InvalidArgumentException if something goes wrong during instantiation of the page
\Zend\Navigation\Exception\InvalidArgumentException if 'type' is given, and the specified type does not extend this class
\Zend\Navigation\Exception\InvalidArgumentException if unable to determine which class to instantiate

Returns

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

findAllBy(string $property, mixed $value) : array
Inherited

inherited_from \Zend\Navigation\AbstractContainer::findAllBy()

Parameters

$property

string

name of property to match against

$value

mixed

value to match property against

Returns

arrayarray containing only Page\AbstractPage instances

Returns page(s) matching $property == $value

findBy(string $property, mixed $value, bool $all) : \Zend\Navigation\Page\AbstractPage | null
Inherited

inherited_from \Zend\Navigation\AbstractContainer::findBy()

Parameters

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

Returns

\Zend\Navigation\Page\AbstractPagenullmatching page or null

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

findOneBy(string $property, mixed $value) : \Zend\Navigation\Page\AbstractPage | null
Inherited

inherited_from \Zend\Navigation\AbstractContainer::findOneBy()

Parameters

$property

string

name of property to match against

$value

mixed

value to match property against

Returns

\Zend\Navigation\Page\AbstractPagenullmatching page or null

Returns the value of the given property

get(string $property) : mixed

If the given property is native (id, class, title, etc), the matching get method will be used. Otherwise, it will return the matching custom property, or null if not found.

Parameters

$property

string

property name

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if property name is invalid

Returns

mixedthe property's value or null

Proxy to isActive()

getActive(bool $recursive) : bool

Parameters

$recursive

bool

[optional] whether page should be considered active if any child pages are active. Default is false.

Returns

boolwhether page should be considered active

Returns the child container.

getChildren() : \Zend\Navigation\Page\AbstractPage | null
Inherited

Implements RecursiveIterator interface.

inherited_from \Zend\Navigation\AbstractContainer::getChildren()

Returns

Returns page class (CSS)

getClass() : string | null

Returns

stringnullpage's CSS class or null

Returns custom properties as an array

getCustomProperties() : array

Returns

arrayan array containing custom properties

Returns an array containing the defined forward relations

getDefinedRel() : array

Returns

arraydefined forward relations

Returns an array containing the defined reverse relations

getDefinedRev() : array

Returns

arraydefined reverse relations

Returns fragment identifier

getFragment() : string | null

Returns

stringnullfragment identifier

Returns href for this page

getHref() : string

Returns

stringthe page's href

Returns page id

getId() : string | null

Returns

stringnullpage id or null

Returns page label

getLabel() : string

Returns

stringpage label or null

Returns page order used in parent container

getOrder() : int | null

Returns

intnullpage order or null

Returns pages in the container

getPages() : array
Inherited

inherited_from \Zend\Navigation\AbstractContainer::getPages()

Returns

arrayarray of Page\AbstractPage instances

Returns parent container

getParent() : \Zend\Navigation\AbstractContainer | null

Returns

\Zend\Navigation\AbstractContainernullparent container or null

Returns permission associated with this page

getPermission() : mixed | null

Returns

mixednullpermission or null

Returns ACL privilege associated with this page

getPrivilege() : string | null

Returns

stringnullACL privilege or null

Returns the page's forward links to other pages

getRel(string $relation) : array

This method returns an associative array of forward links to other pages, where each element's key is the name of the relation (e.g. alternate, prev, next, help, etc), and the value is a mixed value that could somehow be considered a page.

Parameters

$relation

string

[optional] name of relation to return. If not given, all relations will be returned.

Returns

arrayan array of relations. If $relation is not specified, all relations will be returned in an associative array.

Returns ACL resource associated with this page

getResource() : string | \Zend\Permissions\Acl\Resource\ResourceInterface | null

Returns

Returns the page's reverse links to other pages

getRev(string $relation) : array

This method returns an associative array of forward links to other pages, where each element's key is the name of the relation (e.g. alternate, prev, next, help, etc), and the value is a mixed value that could somehow be considered a page.

Parameters

$relation

string

[optional] name of relation to return. If not given, all relations will be returned.

Returns

arrayan array of relations. If $relation is not specified, all relations will be returned in an associative array.

Returns page target

getTarget() : string | null

Returns

stringnullpage target or null

Returns text domain for translation

getTextDomain() : mixed | null

Returns

mixednulltext domain or null

Returns page title

getTitle() : string | null

Returns

stringnullpage title or null

Proxy to isVisible()

getVisible(bool $recursive) : bool

Returns a boolean value indicating whether the page is visible

Parameters

$recursive

bool

[optional] whether page should be considered invisible if parent is invisible. Default is false.

Returns

boolwhether page should be considered visible

Proxy to hasPages()

hasChildren() : bool
Inherited

Implements RecursiveIterator interface.

inherited_from \Zend\Navigation\AbstractContainer::hasChildren()

Returns

boolwhether container has any pages

Checks if the container has the given page

hasPage(\Zend\Navigation\Page\AbstractPage $page, bool $recursive) : bool
Inherited

inherited_from \Zend\Navigation\AbstractContainer::hasPage()

Parameters

$page

\Zend\Navigation\Page\AbstractPage

page to look for

$recursive

bool

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

Returns

boolwhether page is in container

Returns true if container contains any pages

hasPages(bool $onlyVisible) : bool
Inherited

inherited_from \Zend\Navigation\AbstractContainer::hasPages()

Parameters

$onlyVisible

bool

whether to check only visible pages

Returns

boolwhether container has any pages

Returns a hash code value for the page

hashCode() : string

Returns

stringa hash code value for this page

Returns whether page should be considered active or not

isActive(bool $recursive) : bool

Parameters

$recursive

bool

[optional] whether page should be considered active if any child pages are active. Default is false.

Returns

boolwhether page should be considered active

Returns a boolean value indicating whether the page is visible

isVisible(bool $recursive) : bool

Parameters

$recursive

bool

[optional] whether page should be considered invisible if parent is invisible. Default is false.

Returns

boolwhether page should be considered visible

Returns hash code of current page

key() : string
Inherited

Implements RecursiveIterator interface.

inherited_from \Zend\Navigation\AbstractContainer::key()

Returns

stringhash code of current page

Notifies container that the order of pages are updated

notifyOrderUpdated() : void
Inherited

inherited_from \Zend\Navigation\AbstractContainer::notifyOrderUpdated()

Removes the given page from the container

removePage(\Zend\Navigation\Page\AbstractPage | int $page, bool $recursive) : bool
Inherited

inherited_from \Zend\Navigation\AbstractContainer::removePage()

Parameters

$page

\Zend\Navigation\Page\AbstractPageint

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

$recursive

bool

[optional] whether to remove recursively

Returns

boolwhether the removal was successful

Removes all pages in container

removePages() : \Zend\Navigation\self
Inherited

inherited_from \Zend\Navigation\AbstractContainer::removePages()

Returns

\Zend\Navigation\selffluent interface, returns self

Removes a forward relation from the page

removeRel(string $relation) : \Zend\Navigation\Page\AbstractPage

Parameters

$relation

string

name of relation to remove

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Removes a reverse relation from the page

removeRev(string $relation) : \Zend\Navigation\Page\AbstractPage

Parameters

$relation

string

name of relation to remove

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Sets index pointer to first page in the container

rewind() : void
Inherited

Implements RecursiveIterator interface.

inherited_from \Zend\Navigation\AbstractContainer::rewind()

Sets the given property

set(string $property, mixed $value) : \Zend\Navigation\Page\AbstractPage

If the given property is native (id, class, title, etc), the matching set method will be used. Otherwise, it will be set as a custom property.

Parameters

$property

string

property name

$value

mixed

value to set

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if property name is invalid

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Sets whether page should be considered active or not

setActive(bool $active) : \Zend\Navigation\Page\AbstractPage

Parameters

$active

bool

[optional] whether page should be considered active or not. Default is true.

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Sets page CSS class

setClass(string | null $class) : \Zend\Navigation\Page\AbstractPage

Parameters

$class

stringnull

[optional] CSS class to set. Default is null, which sets no CSS class.

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if not given string or null

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Sets a fragment identifier

setFragment(string $fragment) : \Zend\Navigation\Page\AbstractPage

Parameters

$fragment

string

new fragment identifier

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if empty/no string is given

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Sets page id

setId(string | null $id) : \Zend\Navigation\Page\AbstractPage

Parameters

$id

stringnull

[optional] id to set. Default is null, which sets no id.

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if not given string or null

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Sets page label

setLabel(string $label) : \Zend\Navigation\Page\AbstractPage

Parameters

$label

string

new page label

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if empty/no string is given

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Sets page properties using options from an associative array

setOptions(array $options) : \Zend\Navigation\Page\AbstractPage

Each key in the array corresponds to the according set*() method, and each word is separated by underscores, e.g. the option 'target' corresponds to setTarget(), and the option 'reset_params' corresponds to the method setResetParams().

Parameters

$options

array

associative array of options to set

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if invalid options are given

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Sets page order to use in parent container

setOrder(int $order) : \Zend\Navigation\Page\AbstractPage

Parameters

$order

int

[optional] page order in container. Default is null, which sets no specific order.

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if order is not integer or null

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Sets pages this container should have, removing existing pages

setPages(array $pages) : \Zend\Navigation\self
Inherited

inherited_from \Zend\Navigation\AbstractContainer::setPages()

Parameters

$pages

array

pages to set

Returns

\Zend\Navigation\selffluent interface, returns self

Sets parent container

setParent(\Zend\Navigation\AbstractContainer $parent) : \Zend\Navigation\Page\AbstractPage

Parameters

$parent

\Zend\Navigation\AbstractContainer

[optional] new parent to set. Default is null which will set no parent.

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Sets permission associated with this page

setPermission(mixed | null $permission) : \Zend\Navigation\Page\AbstractPage

Parameters

$permission

mixednull

[optional] permission to associate with this page. Default is null, which sets no permission.

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Sets ACL privilege associated with this page

setPrivilege(string | null $privilege) : \Zend\Navigation\Page\AbstractPage

Parameters

$privilege

stringnull

[optional] ACL privilege to associate with this page. Default is null, which sets no privilege.

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Sets the page's forward links to other pages

setRel(array | \Traversable $relations) : \Zend\Navigation\Page\AbstractPage

This method expects an associative array of forward links to other pages, where each element's key is the name of the relation (e.g. alternate, prev, next, help, etc), and the value is a mixed value that could somehow be considered a page.

Parameters

$relations

array\Traversable

[optional] an associative array of forward links to other pages

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if $relations is not an array or Traversable object

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Sets ACL resource associated with this page

setResource(string | \Zend\Permissions\Acl\Resource\ResourceInterface $resource) : \Zend\Navigation\Page\AbstractPage

Parameters

$resource

string\Zend\Permissions\Acl\Resource\ResourceInterface

[optional] resource to associate with page. Default is null, which sets no resource.

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if $resource is invalid

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Sets the page's reverse links to other pages

setRev(array | \Traversable $relations) : \Zend\Navigation\Page\AbstractPage

This method expects an associative array of reverse links to other pages, where each element's key is the name of the relation (e.g. alternate, prev, next, help, etc), and the value is a mixed value that could somehow be considered a page.

Parameters

$relations

array\Traversable

[optional] an associative array of reverse links to other pages

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if $relations it not an array or Traversable object

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Sets page target

setTarget(string | null $target) : \Zend\Navigation\Page\AbstractPage

Parameters

$target

stringnull

[optional] target to set. Default is null, which sets no target.

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if target is not string or null

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Sets text domain for translation

setTextDomain(string | null $textDomain) : \Zend\Navigation\Page\AbstractPage

Parameters

$textDomain

stringnull

[optional] text domain to associate with this page. Default is null, which sets no text domain.

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Sets page title

setTitle(string $title) : \Zend\Navigation\Page\AbstractPage

Parameters

$title

string

[optional] page title. Default is null, which sets no title.

Exceptions

\Zend\Navigation\Exception\InvalidArgumentException if not given string or null

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Sets whether the page should be visible or not

setVisible(bool $visible) : \Zend\Navigation\Page\AbstractPage

Parameters

$visible

bool

[optional] whether page should be considered visible or not. Default is true.

Returns

\Zend\Navigation\Page\AbstractPagefluent interface, returns self

Returns an array representation of the page

toArray() : array

Returns

arrayassociative array containing all page properties

Checks if container index is valid

valid() : bool
Inherited

Implements RecursiveIterator interface.

inherited_from \Zend\Navigation\AbstractContainer::valid()

Returns

bool

Initializes page (used by subclasses)

init() : void

Normalizes a property name

normalizePropertyName(string $property) : string

Parameters

$property

string

property name to normalize

Returns

stringnormalized property name

Sorts the page index according to page order

sort() : void
Inherited

inherited_from \Zend\Navigation\AbstractContainer::sort()

 Properties

 

Whether this page should be considered active

$active : bool

 

Style class for this page (CSS)

$class : string | null

 

Whether index is dirty and needs to be re-arranged

$dirtyIndex : bool
Inherited

inherited_from \Zend\Navigation\AbstractContainer::$$dirtyIndex
 

Static factories list for factory pages

$factories : array

 

Fragment identifier (anchor identifier)

$fragment : string | null

The fragment identifier (anchor identifier) pointing to an anchor within a resource that is subordinate to another, primary resource. The fragment identifier introduced by a hash mark "#". Example: http://www.example.org/foo.html#bar ("bar" is the fragment identifier)

link http://www.w3.org/TR/html401/intro/intro.html#fragment-uri
 

Page id

$id : string | null

 

An index that contains the order in which to iterate pages

$index : array
Inherited

inherited_from \Zend\Navigation\AbstractContainer::$$index
 

Page label

$label : string | null

 

Page order used by parent container

$order : int | null

 

Contains sub pages

$pages : array
Inherited

inherited_from \Zend\Navigation\AbstractContainer::$$pages
 

Parent container

$parent : \Zend\Navigation\AbstractContainer | null

 

Permission associated with this page

$permission : mixed | null

 

ACL privilege associated with this page

$privilege : string | null

 

Custom page properties, used by __set(), __get() and __isset()

$properties : array

 

Forward links to other pages

$rel : array
 

ACL resource associated with this page

$resource : string | \Zend\Permissions\Acl\Resource\ResourceInterface | null

 

Reverse links to other pages

$rev : array
 

This page's target

$target : string | null

 

Text domain for Translator

$textDomain : string

 

A more descriptive title for this page

$title : string | null

 

Whether this page should be considered visible

$visible : bool