View/Helper/Navigation/Links.php

Show: PublicProtectedPrivateinherited
Table of Contents
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 [email protected] 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_View  
Subpackage
Helper  
Version
$Id$  

\Zend_View_Helper_Navigation_Links

Package: Zend_View\Helper
Helper for printing elements
Parent(s)
\Zend_View_Helper_Navigation_HelperAbstract < \Zend_View_Helper_HtmlElement < \Zend_View_Helper_Abstract
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Constants

>VConstant  RENDER_ALTERNATE = 1
>VConstant  RENDER_STYLESHEET = 2
>VConstant  RENDER_START = 4
>VConstant  RENDER_NEXT = 8
>VConstant  RENDER_PREV = 16
>VConstant  RENDER_CONTENTS = 32
>VConstant  RENDER_INDEX = 64
>VConstant  RENDER_GLOSSARY = 128
>VConstant  RENDER_COPYRIGHT = 256
>VConstant  RENDER_CHAPTER = 512
>VConstant  RENDER_SECTION = 1024
>VConstant  RENDER_SUBSECTION = 2048
>VConstant  RENDER_APPENDIX = 4096
>VConstant  RENDER_HELP = 8192
>VConstant  RENDER_BOOKMARK = 16384
>VConstant  RENDER_CUSTOM = 32768
>VConstant  RENDER_ALL = 65535

Properties

>VPropertyprotectedarray $_RELATIONS = 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
Maps render constants to W3C link types
Default valuearray(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')Details
Type
array
>VPropertyprotectedint $_renderFlag = self::RENDER_ALL
The helper's render flag
Default valueself::RENDER_ALLDetails
Type
int
See
 
See
 
>VPropertyprotected\Zend_Navigation_Container $_root
Root container
Used for preventing methods to traverse above the container given to the {@link render()} method.
Details
Type
\Zend_Navigation_Container
See
 

Methods

methodpublic__call(string $method, array $arguments = array()) : void

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

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');
Parameters
NameTypeDescription
$methodstring

method name

$argumentsarray

method arguments

Throws
ExceptionDescription
\Zend_Navigation_Exceptionif method does not exist in container
methodprotected_convertToPages(mixed $mixed, bool $recursive = true) : \Zend_Navigation_Page | array | null

Converts a $mixed value to an array of pages

Parameters
NameTypeDescription
$mixedmixed

mixed value to get page(s) from

$recursivebool

whether $value should be looped

                                     if it is an array or a config
Returns
TypeDescription
\Zend_Navigation_Page | array | nullempty if unable to convert
methodprotected_findFromProperty(\Zend_Navigation_Page $page, string $rel, string $type) : \Zend_Navigation_Page | array | null

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

Parameters
NameTypeDescription
$page\Zend_Navigation_Page

page to find relations for

$relstring

relation, 'rel' or 'rev'

$typestring

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

Returns
TypeDescription
\Zend_Navigation_Page | array | nullpage(s), or null if not found
methodprotected_findFromSearch(\Zend_Navigation_Page $page, string $rel, string $type) : array | null

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

Parameters
NameTypeDescription
$page\Zend_Navigation_Page

page to find relations for

$relstring

relation, 'rel' or 'rev'

$typestring

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

Returns
TypeDescription
array | nullarray of pages, or null if not found
methodprotected_findRoot(\Zend_Navigaiton_Page $page) : \Zend_Navigation_Container

Returns the root container of the given page

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
NameTypeDescription
$page\Zend_Navigaiton_Page

page to find root for

Returns
TypeDescription
\Zend_Navigation_Containerthe root container of the given page
methodpublicfindAllRelations(\Zend_Navigation_Page $page,  $flag = null) : array

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

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
NameTypeDescription
$page\Zend_Navigation_Page

page to find links for

$flag
Returns
TypeDescription
arrayrelated pages
methodpublicfindRelation(\Zend_Navigation_Page $page, string $rel, string $type) : \Zend_Navigaiton_Page | array | null

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

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
NameTypeDescription
$page\Zend_Navigation_Page

page to find relations for

$relstring

relation, "rel" or "rev"

$typestring

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

Returns
TypeDescription
\Zend_Navigaiton_Page | array | nullpage(s), or null if not found
Throws
ExceptionDescription
\Zend_View_Exceptionif $rel is not "rel" or "rev"
methodpublicgetRenderFlag() : int

Returns the helper's render flag

Returns
TypeDescription
intrender flag
methodpubliclinks(\Zend_Navigation_Container $container = null) : \Zend_View_Helper_Navigation_Links

View helper entry point: Retrieves helper and optionally sets container to operate on

Parameters
NameTypeDescription
$container\Zend_Navigation_Container

[optional] container to

                                          operate on
Returns
TypeDescription
\Zend_View_Helper_Navigation_Linksfluent interface, returns self
methodpublicrender(\Zend_Navigation_Container $container = null) : string

Renders helper

Implements {@link Zend_View_Helper_Navigation_Helper::render()}.
Parameters
NameTypeDescription
$container\Zend_Navigation_Container

[optional] container to

                                          render. Default is to
                                          render the container
                                          registered in the helper.
Returns
TypeDescription
stringhelper output
methodpublicrenderLink(\Zend_Navigation_Page $page, string $attrib, string $relation) : string

Renders the given $page as a link element, with $attrib = $relation

Parameters
NameTypeDescription
$page\Zend_Navigation_Page

the page to render the link for

$attribstring

the attribute to use for $type,

                                    either 'rel' or 'rev'
$relationstring

relation type, muse be one of; alternate, appendix, bookmark, chapter, contents, copyright, glossary, help, home, index, next, prev, section, start, stylesheet, subsection

Returns
TypeDescription
stringrendered link element
Throws
ExceptionDescription
\Zend_View_Exceptionif $attrib is invalid
methodpublicsearchRelChapter(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | array | null

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

From {@link http://www.w3.org/TR/html4/types.html#type-links}: Refers to a document serving as a chapter in a collection of documents.
Parameters
NameTypeDescription
$page\Zend_Navigation_Page

page to find relation for

Returns
TypeDescription
\Zend_Navigation_Page | array | nullpage(s) or null
methodpublicsearchRelNext(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | null

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

From {@link 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
NameTypeDescription
$page\Zend_Navigation_Page

page to find relation for

Returns
TypeDescription
\Zend_Navigation_Page | nullpage(s) or null
methodpublicsearchRelPrev(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | null

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

From {@link 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
NameTypeDescription
$page\Zend_Navigation_Page

page to find relation for

Returns
TypeDescription
\Zend_Navigation_Page | nullpage or null
methodpublicsearchRelSection(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | array | null

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

From {@link http://www.w3.org/TR/html4/types.html#type-links}: Refers to a document serving as a section in a collection of documents.
Parameters
NameTypeDescription
$page\Zend_Navigation_Page

page to find relation for

Returns
TypeDescription
\Zend_Navigation_Page | array | nullpage(s) or null
methodpublicsearchRelStart(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | null

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

From {@link 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
NameTypeDescription
$page\Zend_Navigation_Page

page to find relation for

Returns
TypeDescription
\Zend_Navigation_Page | nullpage or null
methodpublicsearchRelSubsection(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | array | null

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

From {@link http://www.w3.org/TR/html4/types.html#type-links}: Refers to a document serving as a subsection in a collection of documents.
Parameters
NameTypeDescription
$page\Zend_Navigation_Page

page to find relation for

Returns
TypeDescription
\Zend_Navigation_Page | array | nullpage(s) or null
methodpublicsearchRevSection(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | null

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

From {@link http://www.w3.org/TR/html4/types.html#type-links}: Refers to a document serving as a section in a collection of documents.
Parameters
NameTypeDescription
$page\Zend_Navigation_Page

page to find relation for

Returns
TypeDescription
\Zend_Navigation_Page | nullpage(s) or null
methodpublicsearchRevSubsection(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | null

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

From {@link http://www.w3.org/TR/html4/types.html#type-links}: Refers to a document serving as a subsection in a collection of documents.
Parameters
NameTypeDescription
$page\Zend_Navigation_Page

page to find relation for

Returns
TypeDescription
\Zend_Navigation_Page | nullpage(s) or null
methodpublicsetRenderFlag(int $renderFlag) : \Zend_View_Helper_Navigation_Links

Sets the helper's render flag

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 {@link renderLink()} method.
Parameters
NameTypeDescription
$renderFlagint

render flag

Returns
TypeDescription
\Zend_View_Helper_Navigation_Linksfluent interface, returns self
Documentation was generated by phpDocumentor 2.2.0 .