Helper for printing elements

category Zend
package Zend_View
subpackage Helper
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_View_Helper_Navigation_HelperAbstract

 Methods

Magic overload: Proxy calls to {@link findRelation()} or container

__call(string $method, array $arguments = array()

Examples of finder calls: // METHOD // SAME AS $h->findRelNext($page); // $h->findRelation($page, 'rel', 'next') $h->findRevSection($page); // $h->findRelation($page, 'rev', 'section'); $h->findRelFoo($page); // $h->findRelation($page, 'rel', 'foo');

inherited_from \Zend_View_Helper_Navigation_HelperAbstract::__call()

Parameters

$method

string

method name

$arguments

array

method arguments

Exceptions

\Zend_Navigation_Exception if method does not exist in container

Magic overload: Proxy calls to the navigation container

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

Parameters

$method

string

method name in container

$arguments

array

[optional] arguments to pass

Exceptions

\Zend_Navigation_Exception if method does not exist in container

Returns

mixedreturns what the container returns

Magic overload: Proxy to {@link render()}.

__toString() : string
Inherited

This method will trigger an E_USER_ERROR if rendering the helper causes an exception to be thrown.

Implements Zend_View_Helper_Navigation_Helper::__toString().

inherited_from \Zend_View_Helper_Navigation_Helper::__toString()

Returns

string

Determines whether a page should be accepted when iterating

accept(\Zend_Navigation_Page $page, boolean $recursive = true) : boolean
Inherited

Rules:

  • If a page is not visible it is not accepted, unless RenderInvisible has been set to true.
  • If helper has no ACL, page is accepted
  • If helper has ACL, but no role, page is not accepted
  • If helper has ACL and role:
    • Page is accepted if it has no resource or privilege
    • Page is accepted if ACL allows page's resource or privilege
  • If page is accepted by the rules above and $recursive is true, the page will not be accepted if it is the descendant of a non-accepted page.

Parameters

$page

\Zend_Navigation_Page

page to check

$recursive

boolean

[optional] if true, page will not be accepted if it is the descendant of a page that is not accepted. Default is true.

Returns

booleanwhether page should be accepted

Strategy pattern: currently unutilized

direct() : void
Inherited
inherited_from \Zend_View_Helper_Interface::direct()

Finds the deepest active page in the given container

findActive(\Zend_Navigation_Container $container, integer|null $minDepth = null, $maxDepth = -1) : array
Inherited

Parameters

$container

\Zend_Navigation_Container

container to search

$minDepth

integernullintegernull

[optional] minimum depth required for page to be valid. Default is to use {@link getMinDepth()}. A null value means no minimum depth required.

$maxDepth

Returns

arrayan associative array with the values 'depth' and 'page', or an empty array if not found

Finds all relations (forward and reverse) for the given $page

findAllRelations(\Zend_Navigation_Page $page, $flag = null) : array

The form of the returned array: // $page denotes an instance of Zend_Navigation_Page $returned = array( 'rel' => array( 'alternate' => array($page, $page, $page), 'start' => array($page), 'next' => array($page), 'prev' => array($page), 'canonical' => array($page) ), 'rev' => array( 'section' => array($page) ) );

Parameters

$page

\Zend_Navigation_Page

page to find links for

$flag

Returns

arrayrelated pages

Finds relations of the given $rel=$type from $page

findRelation(\Zend_Navigation_Page $page, string $rel, string $type) : \Zend_Navigaiton_Page | array | null

This method will first look for relations in the page instance, then by searching the root container if nothing was found in the page.

Parameters

$page

\Zend_Navigation_Page

page to find relations for

$rel

string

relation, "rel" or "rev"

$type

string

link type, e.g. 'start', 'next'

Exceptions

\Zend_View_Exception if $rel is not "rel" or "rev"

Returns

\Zend_Navigaiton_Pagearraynullpage(s), or null if not found

Returns ACL or null if it isn't set using {@link setAcl()} or {@link setDefaultAcl()}

getAcl() : \Zend_Acl | null
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::getAcl()

Returns

\Zend_AclnullACL object or null

Get the tag closing bracket

getClosingBracket() : string
Inherited

Returns

string

Returns the navigation container helper operates on by default

getContainer() : \Zend_Navigation_Container
Inherited

Implements \Zend_View_Helper_Navigation_Interface::getContainer().

If a helper is not explicitly set in this helper instance by calling \setContainer() or by passing it through the helper entry point, this method will look in Zend_Registry for a container by using the key 'Zend_Navigation'.

If no container is set, and nothing is found in Zend_Registry, a new container will be instantiated and stored in the helper.

inherited_from \Zend_View_Helper_Navigation_Helper::getContainer()

Returns

\Zend_Navigation_Containernavigation container

Returns the EOL character (format output is respected)

getEOL() : string
Inherited
see
see

Returns

stringstandard EOL charater or an empty string

Returns whether HTML/XML output should be formatted

getFormatOutput() : boolean
Inherited

Returns

booleanwhether HTML/XML output should be formatted

Returns indentation (format output is respected)

getIndent() : string
Inherited

Returns

stringindentation string or an empty string

Returns maximum depth a page can have to be included when rendering

getMaxDepth() : integer | null
Inherited

Returns

integernullmaximum depth or null

Returns minimum depth a page must have to be included when rendering

getMinDepth() : integer | null
Inherited

Returns

integernullminimum depth or null

Returns prefix for IDs when they are normalized

getPrefixForId() : string
Inherited

Returns

stringPrefix for

Returns the helper's render flag

getRenderFlag() : integer

Returns

integerrender flag

Return renderInvisible flag

getRenderInvisible() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::getRenderInvisible()

Returns

boolean

Returns ACL role to use when iterating pages, or null if it isn't set using {@link setRole()} or {@link setDefaultRole()}

getRole() : string | \Zend_Acl_Role_Interface | null
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::getRole()

Returns

string\Zend_Acl_Role_Interfacenullrole or null

Returns translator used in helper

getTranslator() : \Zend_Translate_Adapter | null
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::getTranslator()

Returns

\Zend_Translate_Adapternulltranslator or null

Returns whether ACL should be used

getUseAcl() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::getUseAcl()

Returns

booleanwhether ACL should be used

Returns whether translator should be used

getUseTranslator() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::getUseTranslator()

Returns

booleanwhether translator should be used

Checks if the helper has an ACL instance

hasAcl() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::hasAcl()

Returns

booleanwhether the helper has a an ACL instance or not

Checks if the helper has a container

hasContainer() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::hasContainer()

Returns

booleanwhether the helper has a container or not

Checks if the helper has an ACL role

hasRole() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::hasRole()

Returns

booleanwhether the helper has a an ACL role or not

Checks if the helper has a translator

hasTranslator() : boolean
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::hasTranslator()

Returns

booleanwhether the helper has a translator or not

Returns an HTML string containing an 'a' element for the given page

htmlify(\Zend_Navigation_Page $page) : string
Inherited

Parameters

$page

\Zend_Navigation_Page

page to generate HTML for

Returns

stringHTML string for the given page

Renders helper

render(\Zend_Navigation_Container $container = null) : string

Parameters

$container

\Zend_Navigation_Container

[optional] container to render. Default is to render the container registered in the helper.

Returns

stringhelper output

Searches the root container for forward 'chapter' relations of the given $page

searchRelChapter(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | array | null

From http://www.w3.org/TR/html4/types.html#type-links: Refers to a document serving as a chapter in a collection of documents.

Parameters

$page

\Zend_Navigation_Page

page to find relation for

Returns

\Zend_Navigation_Pagearraynullpage(s) or null

Searches the root container for the forward 'next' relation of the given $page

searchRelNext(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | null

From http://www.w3.org/TR/html4/types.html#type-links: Refers to the next document in a linear sequence of documents. User agents may choose to preload the "next" document, to reduce the perceived load time.

Parameters

$page

\Zend_Navigation_Page

page to find relation for

Returns

\Zend_Navigation_Pagenullpage(s) or null

Searches the root container for the forward 'prev' relation of the given $page

searchRelPrev(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | null

From http://www.w3.org/TR/html4/types.html#type-links: Refers to the previous document in an ordered series of documents. Some user agents also support the synonym "Previous".

Parameters

$page

\Zend_Navigation_Page

page to find relation for

Returns

\Zend_Navigation_Pagenullpage or null

Searches the root container for forward 'section' relations of the given $page

searchRelSection(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | array | null

From http://www.w3.org/TR/html4/types.html#type-links: Refers to a document serving as a section in a collection of documents.

Parameters

$page

\Zend_Navigation_Page

page to find relation for

Returns

\Zend_Navigation_Pagearraynullpage(s) or null

Searches the root container for the forward 'start' relation of the given $page

searchRelStart(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | null

From http://www.w3.org/TR/html4/types.html#type-links: Refers to the first document in a collection of documents. This link type tells search engines which document is considered by the author to be the starting point of the collection.

Parameters

$page

\Zend_Navigation_Page

page to find relation for

Returns

\Zend_Navigation_Pagenullpage or null

Searches the root container for forward 'subsection' relations of the given $page

searchRelSubsection(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | array | null

From http://www.w3.org/TR/html4/types.html#type-links: Refers to a document serving as a subsection in a collection of documents.

Parameters

$page

\Zend_Navigation_Page

page to find relation for

Returns

\Zend_Navigation_Pagearraynullpage(s) or null

Searches the root container for the reverse 'section' relation of the given $page

searchRevSection(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | null

From http://www.w3.org/TR/html4/types.html#type-links: Refers to a document serving as a section in a collection of documents.

Parameters

$page

\Zend_Navigation_Page

page to find relation for

Returns

\Zend_Navigation_Pagenullpage(s) or null

Searches the root container for the reverse 'section' relation of the given $page

searchRevSubsection(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | null

From http://www.w3.org/TR/html4/types.html#type-links: Refers to a document serving as a subsection in a collection of documents.

Parameters

$page

\Zend_Navigation_Page

page to find relation for

Returns

\Zend_Navigation_Pagenullpage(s) or null

Sets ACL to use when iterating pages

setAcl(\Zend_Acl $acl = null) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::setAcl()

Parameters

$acl

\Zend_Acl

[optional] ACL object. Default is null.

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets navigation container the helper operates on by default

setContainer(\Zend_Navigation_Container $container = null) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited

Implements \Zend_View_Helper_Navigation_Interface::setContainer().

inherited_from \Zend_View_Helper_Navigation_Helper::setContainer()

Parameters

$container

\Zend_Navigation_Container

[optional] container to operate on. Default is null, meaning container will be reset.

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets default ACL to use if another ACL is not explicitly set

setDefaultAcl(\Zend_Acl $acl = null) : void
InheritedStatic

Parameters

$acl

\Zend_Acl

[optional] ACL object. Default is null, which sets no ACL object.

Sets default ACL role(s) to use when iterating pages if not explicitly set later with {@link setRole()}

setDefaultRole(mixed $role = null) : void
InheritedStatic

Parameters

$role

mixed

[optional] role to set. Expects null, string, or an instance of {@link Zend_Acl_Role_Interface}. Default is null, which sets no default role.

Exceptions

\Zend_View_Exception if role is invalid

Sets whether HTML/XML output should be formatted

setFormatOutput(boolean $formatOutput = true) : \Zend_View_Helper_Navigation_Sitemap
Inherited

Parameters

$formatOutput

boolean

[optional] whether output should be formatted. Default is true.

Returns

\Zend_View_Helper_Navigation_Sitemapfluent interface, returns self

Set the indentation string for using in {@link render()}, optionally a number of spaces to indent with

setIndent(string|integer $indent) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited

Parameters

$indent

stringinteger

indentation string or number of spaces

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets the maximum depth a page can have to be included when rendering

setMaxDepth(integer $maxDepth = null) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited

Parameters

$maxDepth

integer

[optional] maximum depth. Default is null, which sets no maximum depth.

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets the minimum depth a page must have to be included when rendering

setMinDepth(integer $minDepth = null) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited

Parameters

$minDepth

integer

[optional] minimum depth. Default is null, which sets no minimum depth.

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets prefix for IDs when they are normalized

setPrefixForId(string $prefix) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited

Parameters

$prefix

string

Prefix for IDs

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets the helper's render flag

setRenderFlag(integer $renderFlag) : \Zend_View_Helper_Navigation_Links

The helper uses the bitwise '&' operator against the hex values of the render constants. This means that the flag can is "bitwised" value of the render constants. Examples: // render all links except glossary $flag = Zend_View_Helper_Navigation_Links:RENDER_ALL ^ Zend_View_Helper_Navigation_Links:RENDER_GLOSSARY; $helper->setRenderFlag($flag);

// render only chapters and sections $flag = Zend_View_Helper_Navigation_Links:RENDER_CHAPTER | Zend_View_Helper_Navigation_Links:RENDER_SECTION; $helper->setRenderFlag($flag);

// render only relations that are not native W3C relations $helper->setRenderFlag(Zend_View_Helper_Navigation_Links:RENDER_CUSTOM);

// render all relations (default) $helper->setRenderFlag(Zend_View_Helper_Navigation_Links:RENDER_ALL);

Note that custom relations can also be rendered directly using the \renderLink() method.

Parameters

$renderFlag

integer

render flag

Returns

\Zend_View_Helper_Navigation_Linksfluent interface, returns self

Render invisible items?

setRenderInvisible(boolean $renderInvisible = true) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::setRenderInvisible()

Parameters

$renderInvisible

boolean

[optional] boolean flag

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface returns self

Sets ACL role(s) to use when iterating pages

setRole(mixed $role = null) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::setRole()

Parameters

$role

mixed

[optional] role to set. Expects a string, an instance of type {@link Zend_Acl_Role_Interface}, or null. Default is null, which will set no role.

Exceptions

\Zend_View_Exception if $role is invalid

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets translator to use in helper

setTranslator(mixed $translator = null) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::setTranslator()

Parameters

$translator

mixed

[optional] translator. Expects an object of type {@link Zend_Translate_Adapter} or {@link Zend_Translate}, or null. Default is null, which sets no translator.

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets whether ACL should be used

setUseAcl(boolean $useAcl = true) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::setUseAcl()

Parameters

$useAcl

boolean

[optional] whether ACL should be used. Default is true.

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Sets whether translator should be used

setUseTranslator(boolean $useTranslator = true) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited
inherited_from \Zend_View_Helper_Navigation_Helper::setUseTranslator()

Parameters

$useTranslator

boolean

[optional] whether translator should be used. Default is true.

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Set the View object

setView(\Zend_View_Interface $view) : \Zend_View_Helper_Abstract
Inherited
inherited_from \Zend_View_Helper_Interface::setView()

Parameters

$view

\Zend_View_Interface

Returns

\Zend_View_Helper_Abstract

Skip the current prefix for IDs when they are normalized

skipPrefixForId(boolean $flag = true) : \Zend_View_Helper_Navigation_HelperAbstract
Inherited

Parameters

$flag

boolean

Returns

\Zend_View_Helper_Navigation_HelperAbstractfluent interface, returns self

Determines whether a page should be accepted by ACL when iterating

_acceptAcl(\Zend_Navigation_Page $page) : boolean
Inherited

Rules:

  • If helper has no ACL, page is accepted
  • If page has a resource or privilege defined, page is accepted if the ACL allows access to it using the helper's role
  • If page has no resource or privilege, page is accepted

Parameters

$page

\Zend_Navigation_Page

page to check

Returns

booleanwhether page is accepted by ACL

Converts a $mixed value to an array of pages

_convertToPages(mixed $mixed, boolean $recursive = true) : \Zend_Navigation_Page | array | null

Parameters

$mixed

mixed

mixed value to get page(s) from

$recursive

boolean

whether $value should be looped if it is an array or a config

Returns

\Zend_Navigation_Pagearraynullempty if unable to convert

Finds relations of given $type for $page by checking if the relation is specified as a property of $page

_findFromProperty(\Zend_Navigation_Page $page, string $rel, string $type) : \Zend_Navigation_Page | array | null

Parameters

$page

\Zend_Navigation_Page

page to find relations for

$rel

string

relation, 'rel' or 'rev'

$type

string

link type, e.g. 'start', 'next'

Returns

\Zend_Navigation_Pagearraynullpage(s), or null if not found

Finds relations of given $rel=$type for $page by using the helper to search for the relation in the root container

_findFromSearch(\Zend_Navigation_Page $page, string $rel, string $type) : array | null

Parameters

$page

\Zend_Navigation_Page

page to find relations for

$rel

string

relation, 'rel' or 'rev'

$type

string

link type, e.g. 'start', 'next', etc

Returns

arraynullarray of pages, or null if not found

Returns the root container of the given page

_findRoot(\Zend_Navigaiton_Page $page) : \Zend_Navigation_Container

When rendering a container, the render method still store the given container as the root container, and unset it when done rendering. This makes sure finder methods will not traverse above the container given to the render method.

Parameters

$page

\Zend_Navigaiton_Page

page to find root for

Returns

\Zend_Navigation_Containerthe root container of the given page

Retrieve whitespace representation of $indent

_getWhitespace(integer|string $indent) : string
Inherited

Parameters

$indent

integerstring

Returns

string

Converts an associative array to a string of tag attributes.

_htmlAttribs(array $attribs) : string
Inherited
access public

Parameters

$attribs

array

From this array, each key-value pair is converted to an attribute name and value.

Returns

stringThe XHTML for the attributes.

Is doctype HTML5?

_isHtml5() : boolean
Inherited

Returns

boolean

Is doctype strict?

_isStrictDoctype() : boolean
Inherited

Returns

boolean

Is doctype XHTML?

_isXhtml() : boolean
Inherited

Returns

boolean

Normalize an ID

_normalizeId(string $value) : string
Inherited

Parameters

$value

string

Returns

string

 Properties

 

View object

$view : \Zend_View_Interface

Default

null
 

Maps render constants to W3C link types

$_RELATIONS : array

Default

array(self::RENDER_ALTERNATE => 'alternate', self::RENDER_STYLESHEET => 'stylesheet', self::RENDER_START => 'start', self::RENDER_NEXT => 'next', self::RENDER_PREV => 'prev', self::RENDER_CONTENTS => 'contents', self::RENDER_INDEX => 'index', self::RENDER_GLOSSARY => 'glossary', self::RENDER_COPYRIGHT => 'copyright', self::RENDER_CHAPTER => 'chapter', self::RENDER_SECTION => 'section', self::RENDER_SUBSECTION => 'subsection', self::RENDER_APPENDIX => 'appendix', self::RENDER_HELP => 'help', self::RENDER_BOOKMARK => 'bookmark')
Static
 

ACL to use when iterating pages

$_acl : \Zend_Acl

Default

 

The tag closing bracket

$_closingBracket : string

Default

null
 

Container to operate on by default

$_container : \Zend_Navigation_Container

Default

 

Default ACL to use when iterating pages if not explicitly set in the instance by calling {@link setAcl()}

$_defaultAcl : \Zend_Acl

Default

Static
 

Default ACL role to use when iterating pages if not explicitly set in the instance by calling {@link setRole()}

$_defaultRole : string | \Zend_Acl_Role_Interface

Default

Static
 

Whether HTML/XML output should be formatted

$_formatOutput : boolean

Default

true
 

Indentation string

$_indent : string

Default

''
 

The maximum depth a page can have to be included when rendering

$_maxDepth : integer

Default

 

The minimum depth a page must have to be included when rendering

$_minDepth : integer

Default

 

Prefix for IDs when they are normalized

$_prefixForId : string | null

Default

null
 

The helper's render flag

$_renderFlag : integer

Default

self::RENDER_ALL
see
see
 

Wheter invisible items should be rendered by this helper

$_renderInvisible : boolean

Default

false
 

ACL role to use when iterating pages

$_role : string | \Zend_Acl_Role_Interface

Default

 

Root container

$_root : \Zend_Navigation_Container

Default

Used for preventing methods to traverse above the container given to the \render() method.

see
 

Skip current prefix for IDs when they are normalized (flag)

$_skipPrefixForId : boolean

Default

false
 

Translator

$_translator : \Zend_Translate_Adapter

Default

 

Whether ACL should be used for filtering out pages

$_useAcl : boolean

Default

true
 

Whether translator should be used for page labels and titles

$_useTranslator : boolean

Default

true

 Constants

 

EOL character

EOL = "\n" 
 

RENDER_ALL

RENDER_ALL = 65535 
 

RENDER_ALTERNATE

RENDER_ALTERNATE = 1 
 

RENDER_APPENDIX

RENDER_APPENDIX = 4096 
 

RENDER_BOOKMARK

RENDER_BOOKMARK = 16384 
 

RENDER_CHAPTER

RENDER_CHAPTER = 512 
 

RENDER_CONTENTS

RENDER_CONTENTS = 32 
   

RENDER_CUSTOM

RENDER_CUSTOM = 32768 
 

RENDER_GLOSSARY

RENDER_GLOSSARY = 128 
 

RENDER_HELP

RENDER_HELP = 8192 
 

RENDER_INDEX

RENDER_INDEX = 64 
 

RENDER_NEXT

RENDER_NEXT = 8 
 

RENDER_PREV

RENDER_PREV = 16 
 

RENDER_SECTION

RENDER_SECTION = 1024 
 

RENDER_START

RENDER_START = 4 
 

RENDER_STYLESHEET

RENDER_STYLESHEET = 2 
 

RENDER_SUBSECTION

RENDER_SUBSECTION = 2048