Class AbstractPage

Summary

Fully Qualified Name: Zend\Navigation\Page\AbstractPage
Extends: AbstractContainer

Description

Base class for Zend\Navigation\Page pages

Methods

Name Description Defined By
__call() Magic overload: Proxy calls to finder methods AbstractContainer
__construct() Page constructor AbstractPage
__get() Returns a property, or null if it doesn't exist AbstractPage
__isset() Checks if a property is set AbstractPage
__set() Sets a custom property AbstractPage
__toString() Returns page label AbstractPage
__unset() Unsets the given custom property AbstractPage
addFactory() Add static factory for self::factory function AbstractPage
addPage() Adds a page to the container AbstractContainer
addPages() Adds several pages at once AbstractContainer
addRel() Adds a forward relation to the page AbstractPage
addRev() Adds a reverse relation to the page AbstractPage
count() Returns number of pages in container AbstractContainer
current() Returns current page AbstractContainer
factory() Factory for Zend\Navigation\Page classes AbstractPage
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
get() Returns the value of the given property AbstractPage
getActive() Proxy to isActive() AbstractPage
getChildren() Returns the child container. AbstractContainer
getClass() Returns page class (CSS) AbstractPage
getCustomProperties() Returns custom properties as an array AbstractPage
getDefinedRel() Returns an array containing the defined forward relations AbstractPage
getDefinedRev() Returns an array containing the defined reverse relations AbstractPage
getFragment() Returns fragment identifier AbstractPage
getHref() Returns href for this page AbstractPage
getId() Returns page id AbstractPage
getLabel() Returns page label AbstractPage
getOrder() Returns page order used in parent container AbstractPage
getPages() Returns pages in the container AbstractContainer
getParent() Returns parent container AbstractPage
getPermission() Returns permission associated with this page AbstractPage
getPrivilege() Returns ACL privilege associated with this page AbstractPage
getRel() Returns the page's forward links to other pages AbstractPage
getResource() Returns ACL resource associated with this page AbstractPage
getRev() Returns the page's reverse links to other pages AbstractPage
getTarget() Returns page target AbstractPage
getTextDomain() Returns text domain for translation AbstractPage
getTitle() Returns page title AbstractPage
getVisible() Proxy to isVisible() AbstractPage
hasChildren() Proxy to hasPages() AbstractContainer
hasPage() Checks if the container has the given page AbstractContainer
hasPages() Returns true if container contains any pages AbstractContainer
hashCode() Returns a hash code value for the page AbstractPage
isActive() Returns whether page should be considered active or not AbstractPage
isVisible() Returns a boolean value indicating whether the page is visible AbstractPage
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
removeRel() Removes a forward relation from the page AbstractPage
removeRev() Removes a reverse relation from the page AbstractPage
rewind() Sets index pointer to first page in the container AbstractContainer
set() Sets the given property AbstractPage
setActive() Sets whether page should be considered active or not AbstractPage
setClass() Sets page CSS class AbstractPage
setFragment() Sets a fragment identifier AbstractPage
setId() Sets page id AbstractPage
setLabel() Sets page label AbstractPage
setOptions() Sets page properties using options from an associative array AbstractPage
setOrder() Sets page order to use in parent container AbstractPage
setPages() Sets pages this container should have, removing existing pages AbstractContainer
setParent() Sets parent container AbstractPage
setPermission() Sets permission associated with this page AbstractPage
setPrivilege() Sets ACL privilege associated with this page AbstractPage
setRel() Sets the page's forward links to other pages AbstractPage
setResource() Sets ACL resource associated with this page AbstractPage
setRev() Sets the page's reverse links to other pages AbstractPage
setTarget() Sets page target AbstractPage
setTextDomain() Sets text domain for translation AbstractPage
setTitle() Sets page title AbstractPage
setVisible() Sets whether the page should be visible or not AbstractPage
toArray() Returns an array representation of the page AbstractPage
valid() Checks if container index is valid AbstractContainer

Method Details

__call()

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:

__construct()

Page constructor

Parameter Name Type Description
$options array|\Traversable [optional]

Returns:

__get()

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

Magic overload for enabling $page->propname.

Parameter Name Type Description
$name string property

Returns: mixed property value or null

__isset()

Checks if a property is set

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

Parameter Name Type Description
$name string property

Returns: bool whether the given property exists

__set()

Sets a custom property

Magic overload for enabling $page->propname = $value.

Parameter Name Type Description
$name string property
$value mixed value

Returns: void

__toString()

Returns page label

Magic overload for enabling echo $page.

Returns: string page label

__unset()

Unsets the given custom property

Magic overload for enabling unset($page->propname).

Parameter Name Type Description
$name string property

Returns: void

addFactory()

Add static factory for self::factory function

Parameter Name Type Description
$callback callable Any

Returns:

addPage()

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

addPages()

Adds several pages at once

Parameter Name Type Description
$pages array|\Traversable|\AbstractContainer pages

Returns: self fluent interface, returns self

addRel()

Adds a forward relation to the page

Parameter Name Type Description
$relation string relation
$value mixed value

Returns: \AbstractPage fluent interface, returns self

addRev()

Adds a reverse relation to the page

Parameter Name Type Description
$relation string relation
$value mixed value

Returns: \AbstractPage fluent interface, returns self

count()

Returns number of pages in container

Implements Countable interface.

Returns: int number of pages in the container

current()

Returns current page

Implements RecursiveIterator interface.

Returns: \Page\AbstractPage current page or null

factory()

Factory for Zend\Navigation\Page classes

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:

Parameter Name Type Description
$options array|\Traversable options

Returns: \AbstractPage a page instance

findAllBy()

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

findBy()

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

findOneBy()

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

get()

Returns the value of the given property

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.

Parameter Name Type Description
$property string property

Returns: mixed the property's value or null

getActive()

Proxy to isActive()

Parameter Name Type Description
$recursive bool [optional]

Returns: bool whether page should be considered active

getChildren()

Returns the child container.

Implements RecursiveIterator interface.

Returns: \Page\AbstractPage|null

getClass()

Returns page class (CSS)

Returns: string|null page's CSS class or null

getCustomProperties()

Returns custom properties as an array

Returns: array an array containing custom properties

getDefinedRel()

Returns an array containing the defined forward relations

Returns: array defined forward relations

getDefinedRev()

Returns an array containing the defined reverse relations

Returns: array defined reverse relations

getFragment()

Returns fragment identifier

Returns: string|null fragment identifier

getHref()

Returns href for this page

Returns: string the page's href

getId()

Returns page id

Returns: string|null page id or null

getLabel()

Returns page label

Returns: string page label or null

getOrder()

Returns page order used in parent container

Returns: int|null page order or null

getPages()

Returns pages in the container

Returns: array array of Page\AbstractPage instances

getParent()

Returns parent container

Returns: \AbstractContainer|null parent container or null

getPermission()

Returns permission associated with this page

Returns: mixed|null permission or null

getPrivilege()

Returns ACL privilege associated with this page

Returns: string|null ACL privilege or null

getRel()

Returns the page's forward links to other pages

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.

Parameter Name Type Description
$relation string [optional]

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

getResource()

Returns ACL resource associated with this page

Returns: string|\AclResource|null ACL resource or null

getRev()

Returns the page's reverse links to other pages

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.

Parameter Name Type Description
$relation string [optional]

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

getTarget()

Returns page target

Returns: string|null page target or null

getTextDomain()

Returns text domain for translation

Returns: mixed|null text domain or null

getTitle()

Returns page title

Returns: string|null page title or null

getVisible()

Proxy to isVisible()

Returns a boolean value indicating whether the page is visible

Parameter Name Type Description
$recursive bool [optional]

Returns: bool whether page should be considered visible

hasChildren()

Proxy to hasPages()

Implements RecursiveIterator interface.

Returns: bool whether container has any pages

hasPage()

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

hasPages()

Returns true if container contains any pages

Parameter Name Type Description
$onlyVisible bool whether

Returns: bool whether container has any pages

hashCode()

Returns a hash code value for the page

Returns: string a hash code value for this page

isActive()

Returns whether page should be considered active or not

Parameter Name Type Description
$recursive bool [optional]

Returns: bool whether page should be considered active

isVisible()

Returns a boolean value indicating whether the page is visible

Parameter Name Type Description
$recursive bool [optional]

Returns: bool whether page should be considered visible

key()

Returns hash code of current page

Implements RecursiveIterator interface.

Returns: string hash code of current page

next()

Moves index pointer to next page in the container

Implements RecursiveIterator interface.

Returns: void

notifyOrderUpdated()

Notifies container that the order of pages are updated

Returns: void

removePage()

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

removePages()

Removes all pages in container

Returns: self fluent interface, returns self

removeRel()

Removes a forward relation from the page

Parameter Name Type Description
$relation string name

Returns: \AbstractPage fluent interface, returns self

removeRev()

Removes a reverse relation from the page

Parameter Name Type Description
$relation string name

Returns: \AbstractPage fluent interface, returns self

rewind()

Sets index pointer to first page in the container

Implements RecursiveIterator interface.

Returns: void

set()

Sets the given property

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.

Parameter Name Type Description
$property string property
$value mixed value

Returns: \AbstractPage fluent interface, returns self

setActive()

Sets whether page should be considered active or not

Parameter Name Type Description
$active bool [optional]

Returns: \AbstractPage fluent interface, returns self

setClass()

Sets page CSS class

Parameter Name Type Description
$class string|null [optional]

Returns: \AbstractPage fluent interface, returns self

setFragment()

Sets a fragment identifier

Parameter Name Type Description
$fragment string new

Returns: \AbstractPage fluent interface, returns self

setId()

Sets page id

Parameter Name Type Description
$id string|null [optional]

Returns: \AbstractPage fluent interface, returns self

setLabel()

Sets page label

Parameter Name Type Description
$label string new

Returns: \AbstractPage fluent interface, returns self

setOptions()

Sets page properties using options from an associative array

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().

Parameter Name Type Description
$options array associative

Returns: \AbstractPage fluent interface, returns self

setOrder()

Sets page order to use in parent container

Parameter Name Type Description
$order int [optional]

Returns: \AbstractPage fluent interface, returns self

setPages()

Sets pages this container should have, removing existing pages

Parameter Name Type Description
$pages array pages

Returns: self fluent interface, returns self

setParent()

Sets parent container

Parameter Name Type Description
$parent \AbstractContainer [optional]

Returns: \AbstractPage fluent interface, returns self

setPermission()

Sets permission associated with this page

Parameter Name Type Description
$permission mixed|null [optional]

Returns: \AbstractPage fluent interface, returns self

setPrivilege()

Sets ACL privilege associated with this page

Parameter Name Type Description
$privilege string|null [optional]

Returns: \AbstractPage fluent interface, returns self

setRel()

Sets the page's forward links to other pages

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.

Parameter Name Type Description
$relations array|\Traversable [optional]

Returns: \AbstractPage fluent interface, returns self

setResource()

Sets ACL resource associated with this page

Parameter Name Type Description
$resource string|\AclResource [optional]

Returns: \AbstractPage fluent interface, returns self

setRev()

Sets the page's reverse links to other pages

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.

Parameter Name Type Description
$relations array|\Traversable [optional]

Returns: \AbstractPage fluent interface, returns self

setTarget()

Sets page target

Parameter Name Type Description
$target string|null [optional]

Returns: \AbstractPage fluent interface, returns self

setTextDomain()

Sets text domain for translation

Parameter Name Type Description
$textDomain string|null [optional]

Returns: \AbstractPage fluent interface, returns self

setTitle()

Sets page title

Parameter Name Type Description
$title string [optional]

Returns: \AbstractPage fluent interface, returns self

setVisible()

Sets whether the page should be visible or not

Parameter Name Type Description
$visible bool [optional]

Returns: \AbstractPage fluent interface, returns self

toArray()

Returns an array representation of the page

Returns: array associative array containing all page properties

valid()

Checks if container index is valid

Implements RecursiveIterator interface.

Returns: bool

Top