Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes | Static Protected Attributes

Zend_View_Helper_Navigation_Links Class Reference

Inheritance diagram for Zend_View_Helper_Navigation_Links:
Zend_View_Helper_Navigation_HelperAbstract Zend_View_Helper_HtmlElement Zend_View_Helper_Navigation_Helper Zend_View_Helper_Abstract Zend_View_Helper_Interface

Public Member Functions

 links (Zend_Navigation_Container $container=null)
 __call ($method, array $arguments=array())
 setRenderFlag ($renderFlag)
 getRenderFlag ()
 findAllRelations (Zend_Navigation_Page $page, $flag=null)
 findRelation (Zend_Navigation_Page $page, $rel, $type)
 searchRelStart (Zend_Navigation_Page $page)
 searchRelNext (Zend_Navigation_Page $page)
 searchRelPrev (Zend_Navigation_Page $page)
 searchRelChapter (Zend_Navigation_Page $page)
 searchRelSection (Zend_Navigation_Page $page)
 searchRelSubsection (Zend_Navigation_Page $page)
 searchRevSection (Zend_Navigation_Page $page)
 searchRevSubsection (Zend_Navigation_Page $page)
 renderLink (Zend_Navigation_Page $page, $attrib, $relation)
 render (Zend_Navigation_Container $container=null)

Data Fields

const RENDER_ALTERNATE = 0x0001
const RENDER_STYLESHEET = 0x0002
const RENDER_START = 0x0004
const RENDER_NEXT = 0x0008
const RENDER_PREV = 0x0010
const RENDER_CONTENTS = 0x0020
const RENDER_INDEX = 0x0040
const RENDER_GLOSSARY = 0x0080
const RENDER_COPYRIGHT = 0x0100
const RENDER_CHAPTER = 0x0200
const RENDER_SECTION = 0x0400
const RENDER_SUBSECTION = 0x0800
const RENDER_APPENDIX = 0x1000
const RENDER_HELP = 0x2000
const RENDER_BOOKMARK = 0x4000
const RENDER_CUSTOM = 0x8000
const RENDER_ALL = 0xffff

Protected Member Functions

 _findFromProperty (Zend_Navigation_Page $page, $rel, $type)
 _findFromSearch (Zend_Navigation_Page $page, $rel, $type)
 _findRoot (Zend_Navigation_Page $page)
 _convertToPages ($mixed, $recursive=true)

Protected Attributes

 $_renderFlag = self::RENDER_ALL
 $_root

Static Protected Attributes

static $_RELATIONS

Detailed Description

Definition at line 37 of file Links.php.


Member Function Documentation

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

Magic overload: Proxy calls to 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:
string$methodmethod name
array$argumentsmethod arguments
Exceptions:
Zend_Navigation_Exceptionif method does not exist in container

Reimplemented from Zend_View_Helper_Navigation_HelperAbstract.

Definition at line 141 of file Links.php.

_convertToPages ( mixed,
recursive = true 
) [protected]

Converts a $mixed value to an array of pages

Parameters:
mixed$mixedmixed value to get page(s) from
bool$recursivewhether $value should be looped if it is an array or a config
Returns:
Zend_Navigation_Page|array|null empty if unable to convert

Definition at line 643 of file Links.php.

_findFromProperty ( Zend_Navigation_Page $  page,
rel,
type 
) [protected]

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

Parameters:
Zend_Navigation_Page$pagepage to find relations for
string$relrelation, 'rel' or 'rev'
string$typelink type, e.g. 'start', 'next'
Returns:
Zend_Navigation_Page|array|null page(s), or null if not found

Definition at line 295 of file Links.php.

_findFromSearch ( Zend_Navigation_Page $  page,
rel,
type 
) [protected]

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

Parameters:
Zend_Navigation_Page$pagepage to find relations for
string$relrelation, 'rel' or 'rev'
string$typelink type, e.g. 'start', 'next', etc
Returns:
array|null array of pages, or null if not found

Definition at line 326 of file Links.php.

_findRoot ( Zend_Navigation_Page $  page ) [protected]

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:
Zend_Navigaiton_Page$pagepage to find root for
Returns:
Zend_Navigation_Container the root container of the given page

Definition at line 615 of file Links.php.

findAllRelations ( Zend_Navigation_Page $  page,
flag = null 
)

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:
Zend_Navigation_Page$pagepage to find links for
Returns:
array related pages

Definition at line 225 of file Links.php.

findRelation ( Zend_Navigation_Page $  page,
rel,
type 
)

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:
Zend_Navigation_Page$pagepage to find relations for
string$relrelation, "rel" or "rev"
string$typelink type, e.g. 'start', 'next'
Returns:
Zend_Navigaiton_Page|array|null page(s), or null if not found
Exceptions:
Zend_View_Exceptionif $rel is not "rel" or "rev"

Definition at line 270 of file Links.php.

getRenderFlag (  )

Returns the helper's render flag

Returns:
int render flag

Definition at line 195 of file Links.php.

links ( Zend_Navigation_Container $  container = null )

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

Parameters:
Zend_Navigation_Container$container[optional] container to operate on
Returns:
Zend_View_Helper_Navigation_Links fluent interface, returns self

Definition at line 117 of file Links.php.

render ( Zend_Navigation_Container $  container = null )

Renders helper

Implements Zend_View_Helper_Navigation_Helper::render().

Parameters:
Zend_Navigation_Container$container[optional] container to render. Default is to render the container registered in the helper.
Returns:
string helper output

Implements Zend_View_Helper_Navigation_Helper.

Definition at line 746 of file Links.php.

renderLink ( Zend_Navigation_Page $  page,
attrib,
relation 
)

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

Parameters:
Zend_Navigation_Page$pagethe page to render the link for
string$attribthe attribute to use for $type, either 'rel' or 'rev'
string$relationrelation type, muse be one of; alternate, appendix, bookmark, chapter, contents, copyright, glossary, help, home, index, next, prev, section, start, stylesheet, subsection
Returns:
string rendered link element
Exceptions:
Zend_View_Exceptionif $attrib is invalid

Definition at line 707 of file Links.php.

searchRelChapter ( Zend_Navigation_Page $  page )

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

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:
Zend_Navigation_Page$pagepage to find relation for
Returns:
Zend_Navigation_Page|array|null page(s) or null

Definition at line 444 of file Links.php.

searchRelNext ( Zend_Navigation_Page $  page )

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

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:
Zend_Navigation_Page$pagepage to find relation for
Returns:
Zend_Navigation_Page|null page(s) or null

Definition at line 379 of file Links.php.

searchRelPrev ( Zend_Navigation_Page $  page )

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

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:
Zend_Navigation_Page$pagepage to find relation for
Returns:
Zend_Navigation_Page|null page or null

Definition at line 412 of file Links.php.

searchRelSection ( Zend_Navigation_Page $  page )

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

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:
Zend_Navigation_Page$pagepage to find relation for
Returns:
Zend_Navigation_Page|array|null page(s) or null

Definition at line 486 of file Links.php.

searchRelStart ( Zend_Navigation_Page $  page )

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

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:
Zend_Navigation_Page$pagepage to find relation for
Returns:
Zend_Navigation_Page|null page or null

Definition at line 352 of file Links.php.

searchRelSubsection ( Zend_Navigation_Page $  page )

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

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:
Zend_Navigation_Page$pagepage to find relation for
Returns:
Zend_Navigation_Page|array|null page(s) or null

Definition at line 520 of file Links.php.

searchRevSection ( Zend_Navigation_Page $  page )

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

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:
Zend_Navigation_Page$pagepage to find relation for
Returns:
Zend_Navigation_Page|null page(s) or null

Definition at line 558 of file Links.php.

searchRevSubsection ( Zend_Navigation_Page $  page )

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

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:
Zend_Navigation_Page$pagepage to find relation for
Returns:
Zend_Navigation_Page|null page(s) or null

Definition at line 583 of file Links.php.

setRenderFlag ( renderFlag )

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

Parameters:
int$renderFlagrender flag
Returns:
Zend_View_Helper_Navigation_Links fluent interface, returns self

Definition at line 184 of file Links.php.


Field Documentation

$_RELATIONS [static, protected]
Initial value:
 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'
    )

Definition at line 69 of file Links.php.


The documentation for this class was generated from the following file: