Navigation/Page.php
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.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Navigation
- Version
- $Id$
Package: Zend_NavigationBase class for Zend_Navigation_Page pages
Container class for Zend_Navigation_Page classes.
- Parent(s)
- \Zend_Navigation_Container
- Children
- \Zend_Navigation_Page_Uri
- \Zend_Navigation_Page_Mvc
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties
bool $_active = false
Whether this page should be considered active
Default valuefalse
Details- Type
- bool
string|null $_fragment
Fragment identifier (anchor identifier)
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)
Details- Type
- string | null
- Link
- http://www.w3.org/TR/html401/intro/intro.html#fragment-uri
array $_properties = array()
Custom page properties, used by __set(), __get() and __isset()
Default valuearray()
Details- Type
- array
bool $_visible = true
Whether this page should be considered visible
Default valuetrue
Details- Type
- bool
Methods
__construct(array | \Zend_Config $options = null) : void
ParametersName | Type | Description |
---|
$options | array | \Zend_Config | [optional] page options. Default is
null, which should set defaults.
|
---|
Throws __get(string $name) : mixed
Returns a property, or null if it doesn't exist
Magic overload for enabling $page->propname
.
ParametersName | Type | Description |
---|
$name | string | property name |
---|
ReturnsType | Description |
---|
mixed | property value or null |
Throws__isset(string $name) : bool
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).
ParametersName | Type | Description |
---|
$name | string | property name |
---|
ReturnsType | Description |
---|
bool | whether the given property exists |
__set(string $name, mixed $value) : void
Magic overload for enabling $page->propname = $value
.
ParametersName | Type | Description |
---|
$name | string | property name |
---|
$value | mixed | value to set |
---|
Throws__unset(string $name) : void
Unsets the given custom property
Magic overload for enabling unset($page->propname)
.
ParametersName | Type | Description |
---|
$name | string | property name |
---|
Throws_normalizePropertyName(string $property) : string
staticNormalizes a property name
ParametersName | Type | Description |
---|
$property | string | property name to normalize |
---|
ReturnsType | Description |
---|
string | normalized property name |
addRel(string $relation, mixed $value) : \Zend_Navigation_Page
Adds a forward relation to the page
ParametersName | Type | Description |
---|
$relation | string | relation name (e.g. alternate, glossary,
canonical, etc)
|
---|
$value | mixed | value to set for relation |
---|
Returns addRev(string $relation, mixed $value) : \Zend_Navigation_Page
Adds a reverse relation to the page
ParametersName | Type | Description |
---|
$relation | string | relation name (e.g. alternate, glossary,
canonical, etc)
|
---|
$value | mixed | value to set for relation |
---|
Returns factory(array | \Zend_Config $options) : \Zend_Navigation_Page
staticFactory 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.
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',
'module', 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.
ParametersName | Type | Description |
---|
$options | array | \Zend_Config | options used for creating page |
---|
ReturnsThrowsget(string $property) : mixed
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.
ParametersName | Type | Description |
---|
$property | string | property name |
---|
ReturnsType | Description |
---|
mixed | the property's value or null |
ThrowsgetActive(bool $recursive = false) : bool
ParametersName | Type | Description |
---|
$recursive | bool | [optional] whether page should be considered
active if any child pages are active. Default
is false.
|
---|
ReturnsType | Description |
---|
bool | whether page should be considered active |
getCustomHtmlAttrib(string $name) : string | null
Returns a single custom HTML attributes by name
ParametersName | Type | Description |
---|
$name | string | name of the HTML attribute |
---|
ReturnsType | Description |
---|
string | null | value for the HTML attribute or null |
Throws getCustomHtmlAttribs() : array
Returns all custom HTML attributes as an array
ReturnsType | Description |
---|
array | an array containing custom HTML attributes |
getCustomProperties() : array
Returns custom properties as an array
ReturnsType | Description |
---|
array | an array containing custom properties |
getDefinedRel() : array
Returns an array containing the defined forward relations
ReturnsType | Description |
---|
array | defined forward relations |
getDefinedRev() : array
Returns an array containing the defined reverse relations
ReturnsType | Description |
---|
array | defined reverse relations |
getFragment() : string | null
Returns fragment identifier
ReturnsType | Description |
---|
string | null | fragment identifier |
getHref() : string
abstractReturns href for this page
ReturnsType | Description |
---|
string | the page's href |
getOrder() : int | null
Returns page order used in parent container
ReturnsType | Description |
---|
int | null | page order or null |
getPrivilege() : string | null
Returns ACL privilege associated with this page
ReturnsType | Description |
---|
string | null | ACL privilege or null |
getRel(string $relation = null) : array
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.
ParametersName | Type | Description |
---|
$relation | string | [optional] name of relation to return. If not
given, all relations will be returned.
|
---|
ReturnsType | Description |
---|
array | an array of relations. If $relation is not
specified, all relations will be returned in
an associative array. |
getRev(string $relation = null) : array
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.
ParametersName | Type | Description |
---|
$relation | string | [optional] name of relation to return. If not
given, all relations will be returned.
|
---|
ReturnsType | Description |
---|
array | an array of relations. If $relation is not
specified, all relations will be returned in
an associative array. |
getVisible(bool $recursive = false) : bool
Returns a boolean value indicating whether the page is visible
ParametersName | Type | Description |
---|
$recursive | bool | [optional] whether page should be considered
invisible if parent is invisible. Default is
false.
|
---|
ReturnsType | Description |
---|
bool | whether page should be considered visible |
hashCode() : string
finalReturns a hash code value for the page
ReturnsType | Description |
---|
string | a hash code value for this page |
isActive(bool $recursive = false) : bool
Returns whether page should be considered active or not
ParametersName | Type | Description |
---|
$recursive | bool | [optional] whether page should be considered
active if any child pages are active. Default is
false.
|
---|
ReturnsType | Description |
---|
bool | whether page should be considered active |
isVisible(bool $recursive = false) : bool
Returns a boolean value indicating whether the page is visible
ParametersName | Type | Description |
---|
$recursive | bool | [optional] whether page should be considered
invisible if parent is invisible. Default is
false.
|
---|
ReturnsType | Description |
---|
bool | whether page should be considered visible |
removeCustomHtmlAttrib(string $name) : \Zend_Navigation_Page
Removes a custom HTML attribute from the page
ParametersName | Type | Description |
---|
$name | string | name of the custom HTML attribute |
---|
Returns removeRel(string $relation) : \Zend_Navigation_Page
Removes a forward relation from the page
ParametersName | Type | Description |
---|
$relation | string | name of relation to remove |
---|
Returns removeRev(string $relation) : \Zend_Navigation_Page
Removes a reverse relation from the page
ParametersName | Type | Description |
---|
$relation | string | name of relation to remove |
---|
Returns set(string $property, mixed $value) : \Zend_Navigation_Page
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.
ParametersName | Type | Description |
---|
$property | string | property name |
---|
$value | mixed | value to set |
---|
ReturnsThrowssetAccesskey(string | null $character = null) : \Zend_Navigation_Page
Sets access key for this page
ParametersName | Type | Description |
---|
$character | string | null | [optional] access key to set. Default
is null, which sets no access key.
|
---|
ReturnsThrows setActive(bool $active = true) : \Zend_Navigation_Page
Sets whether page should be considered active or not
ParametersName | Type | Description |
---|
$active | bool | [optional] whether page should be
considered active or not. Default is true.
|
---|
Returns setClass(string | null $class = null) : \Zend_Navigation_Page
ParametersName | Type | Description |
---|
$class | string | null | [optional] CSS class to set. Default
is null, which sets no CSS class.
|
---|
ReturnsThrows setCustomHtmlAttrib(string $name, string | null $value) : \Zend_Navigation_Page
Sets a single custom HTML attribute
ParametersName | Type | Description |
---|
$name | string | name of the HTML attribute |
---|
$value | string | null | value for the HTML attribute |
---|
ReturnsThrows setCustomHtmlAttribs(array $attribs) : \Zend_Navigation_Page
Sets multiple custom HTML attributes at once
ParametersName | Type | Description |
---|
$attribs | array | an associative array of html attributes |
---|
Returns setFragment(string $fragment) : \Zend_Navigation_Page
Sets a fragment identifier
ParametersName | Type | Description |
---|
$fragment | string | new fragment identifier |
---|
ReturnsThrows setId(string | null $id = null) : \Zend_Navigation_Page
ParametersName | Type | Description |
---|
$id | string | null | [optional] id to set. Default is null,
which sets no id.
|
---|
ReturnsThrows setLabel(string $label) : \Zend_Navigation_Page
ParametersName | Type | Description |
---|
$label | string | new page label |
---|
ReturnsThrows setOptions(array $options) : \Zend_Navigation_Page
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().
ParametersName | Type | Description |
---|
$options | array | associative array of options to set |
---|
ReturnsThrowssetOrder(int $order = null) : \Zend_Navigation_Page
Sets page order to use in parent container
ParametersName | Type | Description |
---|
$order | int | [optional] page order in container.
Default is null, which sets no
specific order.
|
---|
ReturnsThrows setPrivilege(string | null $privilege = null) : \Zend_Navigation_Page
Sets ACL privilege associated with this page
ParametersName | Type | Description |
---|
$privilege | string | null | [optional] ACL privilege to associate
with this page. Default is null, which
sets no privilege.
|
---|
Returns setRel(array | \Zend_Config $relations = null) : \Zend_Navigation_Page
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.
ParametersName | Type | Description |
---|
$relations | array | \Zend_Config | [optional] an associative array of
forward links to other pages
|
---|
ReturnssetRev(array | \Zend_Config $relations = null) : \Zend_Navigation_Page
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.
ParametersName | Type | Description |
---|
$relations | array | \Zend_Config | [optional] an associative array of
reverse links to other pages
|
---|
ReturnssetTarget(string | null $target = null) : \Zend_Navigation_Page
ParametersName | Type | Description |
---|
$target | string | null | [optional] target to set. Default is
null, which sets no target.
|
---|
ReturnsThrows setTitle(string $title = null) : \Zend_Navigation_Page
ParametersName | Type | Description |
---|
$title | string | [optional] page title. Default is
null, which sets no title.
|
---|
ReturnsThrows setVisible(bool $visible = true) : \Zend_Navigation_Page
Sets whether the page should be visible or not
ParametersName | Type | Description |
---|
$visible | bool | [optional] whether page should be
considered visible or not. Default is true.
|
---|
Returns toArray() : array
Returns an array representation of the page
ReturnsType | Description |
---|
array | associative array containing all page properties |