API Documentation

View/Helper/Navigation/Links.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_View
subpackage
Helper
version
$Id: Links.php 20096 2010-01-06 02:05:09Z bkarwin $
Classes
Zend_View_Helper_Navigation_Links

Description

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.

Zend_View_Helper_Navigation_Links

Extends from
Zend_View_Helper_Navigation_HelperAbstract
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_View
subpackage
Helper
Constants
RENDER_ALTERNATE
RENDER_STYLESHEET
RENDER_START
RENDER_NEXT
RENDER_PREV
RENDER_CONTENTS
RENDER_INDEX
RENDER_GLOSSARY
RENDER_COPYRIGHT
RENDER_CHAPTER
RENDER_SECTION
RENDER_SUBSECTION
RENDER_APPENDIX
RENDER_HELP
RENDER_BOOKMARK
RENDER_CUSTOM
RENDER_ALL
Properties
$_RELATIONS
$_renderFlag
$_root
Methods
links
__call
setRenderFlag
getRenderFlag
findAllRelations
findRelation
_findFromProperty
_findFromSearch
searchRelStart
searchRelNext
searchRelPrev
searchRelChapter
searchRelSection
searchRelSubsection
searchRevSection
searchRevSubsection
_findRoot
_convertToPages
renderLink
render

Description

Helper for printing <link> elements

Constants

RENDER_ALTERNATE

 RENDER_ALTERNATE = '0x0001'

Details

value
0x0001

RENDER_STYLESHEET

 RENDER_STYLESHEET = '0x0002'

Details

value
0x0002

RENDER_START

 RENDER_START = '0x0004'

Details

value
0x0004

RENDER_NEXT

 RENDER_NEXT = '0x0008'

Details

value
0x0008

RENDER_PREV

 RENDER_PREV = '0x0010'

Details

value
0x0010

RENDER_CONTENTS

 RENDER_CONTENTS = '0x0020'

Details

value
0x0020

RENDER_INDEX

 RENDER_INDEX = '0x0040'

Details

value
0x0040

RENDER_GLOSSARY

 RENDER_GLOSSARY = '0x0080'

Details

value
0x0080

RENDER_COPYRIGHT

 RENDER_COPYRIGHT = '0x0100'

Details

value
0x0100

RENDER_CHAPTER

 RENDER_CHAPTER = '0x0200'

Details

value
0x0200

RENDER_SECTION

 RENDER_SECTION = '0x0400'

Details

value
0x0400

RENDER_SUBSECTION

 RENDER_SUBSECTION = '0x0800'

Details

value
0x0800

RENDER_APPENDIX

 RENDER_APPENDIX = '0x1000'

Details

value
0x1000

RENDER_HELP

 RENDER_HELP = '0x2000'

Details

value
0x2000

RENDER_BOOKMARK

 RENDER_BOOKMARK = '0x4000'

Details

value
0x4000

RENDER_CUSTOM

 RENDER_CUSTOM = '0x8000'

Details

value
0x8000

RENDER_ALL

 RENDER_ALL = '0xffff'

Details

value
0xffff

Properties

$_RELATIONS

array $_RELATIONS = 'array'

Maps render constants to W3C link types

Details

$_RELATIONS
array
visibility
protected
default
array
final
false
static
true

$_renderFlag

int $_renderFlag = 'self'

The helper's render flag

Details

$_renderFlag
int
visibility
protected
default
self
final
false
static
false
see
render()
see
setRenderFlag()

$_root

Zend_Navigation_Container $_root = ''

Root container

Used for preventing methods to traverse above the container given to the {@link render()} method.

Details

$_root
Zend_Navigation_Container
visibility
protected
default
final
false
static
false
see
_findRoot()

Methods

__call

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

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');

Arguments
$method
string
method name
$arguments
array
method arguments
Details
visibility
public
final
false
static
false
throws
if method does not exist in container

_convertToPages

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

Converts a $mixed value to an array of pages

Arguments
$mixed
mixed
mixed value to get page(s) from
$recursive
bool
whether $value should be looped if it is an array or a config
Output
Zend_Navigation_Page|array|null
empty if unable to convert
Details
visibility
protected
final
false
static
false

_findFromProperty

_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

Arguments
$page
Zend_Navigation_Page
page to find relations for
$rel
string
relation, &#039;rel&#039; or &#039;rev&#039;
$type
string
link type, e.g. &#039;start&#039;, &#039;next&#039;
Output
Zend_Navigation_Page|array|null
page(s), or null if not found
Details
visibility
protected
final
false
static
false

_findFromSearch

_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

Arguments
$page
Zend_Navigation_Page
page to find relations for
$rel
string
relation, &#039;rel&#039; or &#039;rev&#039;
$type
string
link type, e.g. &#039;start&#039;, &#039;next&#039;, etc
Output
array|null
array of pages, or null if not found
Details
visibility
protected
final
false
static
false

_findRoot

_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.

Arguments
$page
Zend_Navigaiton_Page
page to find root for
Output
Zend_Navigation_Container
the root container of the given page
Details
visibility
protected
final
false
static
false

findAllRelations

findAllRelations( 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) ) );

Arguments
$page
Zend_Navigation_Page
page to find links for
$flag
Output
array
related pages
Details
visibility
public
final
false
static
false

findRelation

findRelation( 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.

Arguments
$page
Zend_Navigation_Page
page to find relations for
$rel
string
relation, &quot;rel&quot; or &quot;rev&quot;
$type
string
link type, e.g. &#039;start&#039;, &#039;next&#039;
Output
Zend_Navigaiton_Page|array|null
page(s), or null if not found
Details
visibility
public
final
false
static
false
throws
if $rel is not "rel" or "rev"

getRenderFlag

getRenderFlag( ) : int

Returns the helper's render flag

Output
int
render flag
Details
visibility
public
final
false
static
false

links

links( Zend_Navigation_Container $container = null ) : Zend_View_Helper_Navigation_Links

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

Arguments
$container
Zend_Navigation_Container
[optional] container to operate on
Output
Zend_View_Helper_Navigation_Links
fluent interface, returns self
Details
visibility
public
final
false
static
false

render

render( Zend_Navigation_Container $container = null ) : string

Renders helper

Implements {@link Zend_View_Helper_Navigation_Helper::render()}.

Arguments
$container
Zend_Navigation_Container
[optional] container to render. Default is to render the container registered in the helper.
Output
string
helper output
Details
visibility
public
final
false
static
false

renderLink

renderLink( Zend_Navigation_Page $page, string $attrib, string $relation ) : string

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

Arguments
$page
Zend_Navigation_Page
the page to render the link for
$attrib
string
the attribute to use for $type, either &#039;rel&#039; or &#039;rev&#039;
$relation
string
relation type, muse be one of; alternate, appendix, bookmark, chapter, contents, copyright, glossary, help, home, index, next, prev, section, start, stylesheet, subsection
Output
string
rendered link element
Details
visibility
public
final
false
static
false
throws
if $attrib is invalid

searchRelChapter

searchRelChapter( 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.

Arguments
$page
Zend_Navigation_Page
page to find relation for
Output
Zend_Navigation_Page|array|null
page(s) or null
Details
visibility
public
final
false
static
false

searchRelNext

searchRelNext( 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.

Arguments
$page
Zend_Navigation_Page
page to find relation for
Output
Zend_Navigation_Page|null
page(s) or null
Details
visibility
public
final
false
static
false

searchRelPrev

searchRelPrev( 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".

Arguments
$page
Zend_Navigation_Page
page to find relation for
Output
Zend_Navigation_Page|null
page or null
Details
visibility
public
final
false
static
false

searchRelSection

searchRelSection( 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.

Arguments
$page
Zend_Navigation_Page
page to find relation for
Output
Zend_Navigation_Page|array|null
page(s) or null
Details
visibility
public
final
false
static
false

searchRelStart

searchRelStart( 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.

Arguments
$page
Zend_Navigation_Page
page to find relation for
Output
Zend_Navigation_Page|null
page or null
Details
visibility
public
final
false
static
false

searchRelSubsection

searchRelSubsection( 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.

Arguments
$page
Zend_Navigation_Page
page to find relation for
Output
Zend_Navigation_Page|array|null
page(s) or null
Details
visibility
public
final
false
static
false

searchRevSection

searchRevSection( 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.

Arguments
$page
Zend_Navigation_Page
page to find relation for
Output
Zend_Navigation_Page|null
page(s) or null
Details
visibility
public
final
false
static
false

searchRevSubsection

searchRevSubsection( 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.

Arguments
$page
Zend_Navigation_Page
page to find relation for
Output
Zend_Navigation_Page|null
page(s) or null
Details
visibility
public
final
false
static
false

setRenderFlag

setRenderFlag( 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.

Arguments
$renderFlag
int
render flag
Output
Zend_View_Helper_Navigation_Links
fluent interface, returns self
Details
visibility
public
final
false
static
false
Documentation was generated by DocBlox.