View/Helper/Navigation/Links.php
- 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
- 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
Properties
array $_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')
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')
Details- Type
- array
\Zend_Navigation_Container $_root
- Type
- \Zend_Navigation_Container
- See
Methods
__call(string $method, array $arguments = array()) : void
Magic overload: Proxy calls to {@link findRelation()} or container
// 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');
Name | Type | Description |
---|---|---|
$method | string | method name |
$arguments | array | method arguments |
Exception | Description |
---|---|
\Zend_Navigation_Exception | if method does not exist in container |
_convertToPages(mixed $mixed, bool $recursive = true) : \Zend_Navigation_Page | array | null
Converts a $mixed value to an array of pages
Name | Type | Description |
---|---|---|
$mixed | mixed | mixed value to get page(s) from |
$recursive | bool | whether $value should be looped
|
Type | Description |
---|---|
\Zend_Navigation_Page | array | null | empty if unable to convert |
_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
Name | Type | Description |
---|---|---|
$page | \Zend_Navigation_Page | page to find relations for |
$rel | string | relation, 'rel' or 'rev' |
$type | string | link type, e.g. 'start', 'next' |
Type | Description |
---|---|
\Zend_Navigation_Page | array | null | page(s), or null if not found |
_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
Name | Type | Description |
---|---|---|
$page | \Zend_Navigation_Page | page to find relations for |
$rel | string | relation, 'rel' or 'rev' |
$type | string | link type, e.g. 'start', 'next', etc |
Type | Description |
---|---|
array | null | array of pages, or null if not found |
_findRoot(\Zend_Navigaiton_Page $page) : \Zend_Navigation_Container
Returns the root container of the given page
Name | Type | Description |
---|---|---|
$page | \Zend_Navigaiton_Page | page to find root for |
Type | Description |
---|---|
\Zend_Navigation_Container | the root container of the given page |
findAllRelations(\Zend_Navigation_Page $page, $flag = null) : array
Finds all relations (forward and reverse) for the given $page
// $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)
)
);
Name | Type | Description |
---|---|---|
$page | \Zend_Navigation_Page | page to find links for |
$flag |
Type | Description |
---|---|
array | related pages |
findRelation(\Zend_Navigation_Page $page, string $rel, string $type) : \Zend_Navigaiton_Page | array | null
Finds relations of the given $rel=$type from $page
Name | Type | Description |
---|---|---|
$page | \Zend_Navigation_Page | page to find relations for |
$rel | string | relation, "rel" or "rev" |
$type | string | link type, e.g. 'start', 'next' |
Type | Description |
---|---|
\Zend_Navigaiton_Page | array | null | page(s), or null if not found |
Exception | Description |
---|---|
\Zend_View_Exception | if $rel is not "rel" or "rev" |
links(\Zend_Navigation_Container $container = null) : \Zend_View_Helper_Navigation_Links
View helper entry point: Retrieves helper and optionally sets container to operate on
Name | Type | Description |
---|---|---|
$container | \Zend_Navigation_Container | [optional] container to
|
Type | Description |
---|---|
\Zend_View_Helper_Navigation_Links | fluent interface, returns self |
render(\Zend_Navigation_Container $container = null) : string
Renders helper
Name | Type | Description |
---|---|---|
$container | \Zend_Navigation_Container | [optional] container to
|
Type | Description |
---|---|
string | helper output |
renderLink(\Zend_Navigation_Page $page, string $attrib, string $relation) : string
Renders the given $page as a link element, with $attrib = $relation
Name | Type | Description |
---|---|---|
$page | \Zend_Navigation_Page | the page to render the link for |
$attrib | string | the attribute to use for $type,
|
$relation | string | relation type, muse be one of; alternate, appendix, bookmark, chapter, contents, copyright, glossary, help, home, index, next, prev, section, start, stylesheet, subsection |
Type | Description |
---|---|
string | rendered link element |
Exception | Description |
---|---|
\Zend_View_Exception | if $attrib is invalid |
searchRelChapter(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | array | null
Searches the root container for forward 'chapter' relations of the given $page
Name | Type | Description |
---|---|---|
$page | \Zend_Navigation_Page | page to find relation for |
Type | Description |
---|---|
\Zend_Navigation_Page | array | null | page(s) or null |
searchRelNext(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | null
Searches the root container for the forward 'next' relation of the given $page
Name | Type | Description |
---|---|---|
$page | \Zend_Navigation_Page | page to find relation for |
Type | Description |
---|---|
\Zend_Navigation_Page | null | page(s) or null |
searchRelPrev(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | null
Searches the root container for the forward 'prev' relation of the given $page
Name | Type | Description |
---|---|---|
$page | \Zend_Navigation_Page | page to find relation for |
Type | Description |
---|---|
\Zend_Navigation_Page | null | page or null |
searchRelSection(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | array | null
Searches the root container for forward 'section' relations of the given $page
Name | Type | Description |
---|---|---|
$page | \Zend_Navigation_Page | page to find relation for |
Type | Description |
---|---|
\Zend_Navigation_Page | array | null | page(s) or null |
searchRelStart(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | null
Searches the root container for the forward 'start' relation of the given $page
Name | Type | Description |
---|---|---|
$page | \Zend_Navigation_Page | page to find relation for |
Type | Description |
---|---|
\Zend_Navigation_Page | null | page or null |
searchRelSubsection(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | array | null
Searches the root container for forward 'subsection' relations of the given $page
Name | Type | Description |
---|---|---|
$page | \Zend_Navigation_Page | page to find relation for |
Type | Description |
---|---|
\Zend_Navigation_Page | array | null | page(s) or null |
searchRevSection(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | null
Searches the root container for the reverse 'section' relation of the given $page
Name | Type | Description |
---|---|---|
$page | \Zend_Navigation_Page | page to find relation for |
Type | Description |
---|---|
\Zend_Navigation_Page | null | page(s) or null |
searchRevSubsection(\Zend_Navigation_Page $page) : \Zend_Navigation_Page | null
Searches the root container for the reverse 'section' relation of the given $page
Name | Type | Description |
---|---|---|
$page | \Zend_Navigation_Page | page to find relation for |
Type | Description |
---|---|
\Zend_Navigation_Page | null | page(s) or null |
setRenderFlag(int $renderFlag) : \Zend_View_Helper_Navigation_Links
Sets the helper's render flag
// 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.Name | Type | Description |
---|---|---|
$renderFlag | int | render flag |
Type | Description |
---|---|
\Zend_View_Helper_Navigation_Links | fluent interface, returns self |