Fully Qualified Name: | Zend\View\Helper\Navigation\Links |
Extends: | AbstractHelper |
Helper for printing elements
Name | Description | Defined By |
---|---|---|
__call() | Magic overload: Proxy calls to {@link findRelation()} or container | Links |
__invoke() | Helper entry point | Links |
__toString() | Magic overload: Proxy to {@link render()}. | AbstractHelper |
accept() | Determines whether a page should be accepted when iterating | AbstractHelper |
findActive() | Finds the deepest active page in the given container | AbstractHelper |
findAllRelations() | Finds all relations (forward and reverse) for the given $page | Links |
findRelation() | Finds relations of the given $rel=$type from $page | Links |
getAcl() | Returns ACL or null if it isn't set using {@link setAcl()} or {@link setDefaultAcl()} | AbstractHelper |
getContainer() | Returns the navigation container helper operates on by default | AbstractHelper |
getEventManager() | Get the event manager, if present. | AbstractHelper |
getIndent() | Returns indentation | AbstractHelper |
getMaxDepth() | Returns maximum depth a page can have to be included when rendering | AbstractHelper |
getMinDepth() | Returns minimum depth a page must have to be included when rendering | AbstractHelper |
getRenderFlag() | Returns the helper's render flag | Links |
getRenderInvisible() | Return renderInvisible flag | AbstractHelper |
getRole() | Returns ACL role to use when iterating pages, or null if it isn't set using {@link setRole()} or {@link setDefaultRole()} | AbstractHelper |
getServiceLocator() | Get the service locator. | AbstractHelper |
getUseAcl() | Returns whether ACL should be used | AbstractHelper |
hasAcl() | Checks if the helper has an ACL instance | AbstractHelper |
hasContainer() | Checks if the helper has a container | AbstractHelper |
hasRole() | Checks if the helper has an ACL role | AbstractHelper |
htmlify() | Returns an HTML string containing an 'a' element for the given page | AbstractHelper |
render() | Renders helper | Links |
renderLink() | Renders the given $page as a link element, with $attrib = $relation | Links |
searchRelChapter() | Searches the root container for forward 'chapter' relations of the given $page | Links |
searchRelNext() | Searches the root container for the forward 'next' relation of the given $page | Links |
searchRelPrev() | Searches the root container for the forward 'prev' relation of the given $page | Links |
searchRelSection() | Searches the root container for forward 'section' relations of the given $page | Links |
searchRelStart() | Searches the root container for the forward 'start' relation of the given $page | Links |
searchRelSubsection() | Searches the root container for forward 'subsection' relations of the given $page | Links |
searchRevSection() | Searches the root container for the reverse 'section' relation of the given $page | Links |
searchRevSubsection() | Searches the root container for the reverse 'section' relation of the given $page | Links |
setAcl() | Sets ACL to use when iterating pages | AbstractHelper |
setContainer() | Sets navigation container the helper operates on by default | AbstractHelper |
setDefaultAcl() | Sets default ACL to use if another ACL is not explicitly set | AbstractHelper |
setDefaultRole() | Sets default ACL role(s) to use when iterating pages if not explicitly set later with {@link setRole()} | AbstractHelper |
setEventManager() | Set the event manager. | AbstractHelper |
setIndent() | Set the indentation string for using in {@link render()}, optionally a number of spaces to indent with | AbstractHelper |
setMaxDepth() | Sets the maximum depth a page can have to be included when rendering | AbstractHelper |
setMinDepth() | Sets the minimum depth a page must have to be included when rendering | AbstractHelper |
setRenderFlag() | Sets the helper's render flag | Links |
setRenderInvisible() | Render invisible items? | AbstractHelper |
setRole() | Sets ACL role(s) to use when iterating pages | AbstractHelper |
setServiceLocator() | Set the service locator. | AbstractHelper |
setUseAcl() | Sets whether ACL should be used | AbstractHelper |
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');
Parameter Name | Type | Description |
---|---|---|
$method | string | |
$arguments | array |
Returns: mixed
Helper entry point
Parameter Name | Type | Description |
---|---|---|
$container | string|\AbstractContainer | container |
Returns: \Links
Magic overload: Proxy to {@link render()}.
This method will trigger an E_USER_ERROR if rendering the helper causes an exception to be thrown.
Implements {@link HelperInterface::__toString()}.
Returns: string
Determines whether a page should be accepted when iterating
Default listener may be 'overridden' by attaching listener to 'isAllowed' method. Listener must be 'short circuited' if overriding default ACL listener.
Rules:
Parameter Name | Type | Description |
---|---|---|
$page | \AbstractPage | page |
$recursive | bool | [optional] |
Returns: bool Whether page should be accepted
Finds the deepest active page in the given container
Parameter Name | Type | Description |
---|---|---|
$container | \Navigation\AbstractContainer | container |
$minDepth | int|null | [optional] |
$maxDepth | int|null | [optional] |
Returns: array an 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
The form of the returned array:
// $page denotes an instance of Zend\Navigation\Page\AbstractPage
$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)
)
);
Parameter Name | Type | Description |
---|---|---|
$page | \AbstractPage | page |
$ | null|int | |
$flag |
Returns: array
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.
Parameter Name | Type | Description |
---|---|---|
$page | \AbstractPage | page |
$rel | string | relation, |
$type | string | link |
Returns: \AbstractPage|array|null
Returns ACL or null if it isn't set using {@link setAcl()} or {@link setDefaultAcl()}
Implements {@link HelperInterface::getAcl()}.
Returns: \Acl\AclInterface|null ACL object or null
Returns the navigation container helper operates on by default
Implements {@link HelperInterface::getContainer()}.
If no container is set, a new container will be instantiated and stored in the helper.
Returns: \Navigation\AbstractContainer navigation container
Get the event manager, if present.
Internally, the helper will lazy-load an EM instance the first time it requires one, but ideally it should be injected during instantiation.
Returns: null|\EventManagerInterface
Returns indentation
Returns: string
Returns maximum depth a page can have to be included when rendering
Returns: int|null
Returns minimum depth a page must have to be included when rendering
Returns: int|null
Returns the helper's render flag
Returns: int
Return renderInvisible flag
Returns: bool
Returns ACL role to use when iterating pages, or null if it isn't set using {@link setRole()} or {@link setDefaultRole()}
Implements {@link HelperInterface::getRole()}.
Returns: string|\Acl\Role\RoleInterface|null
Get the service locator.
Used internally to pull named navigation containers to render.
Returns: \ContainerInterface
Returns whether ACL should be used
Implements {@link HelperInterface::getUseAcl()}.
Returns: bool
Checks if the helper has an ACL instance
Implements {@link HelperInterface::hasAcl()}.
Returns: bool
Checks if the helper has a container
Implements {@link HelperInterface::hasContainer()}.
Returns: bool
Checks if the helper has an ACL role
Implements {@link HelperInterface::hasRole()}.
Returns: bool
Returns an HTML string containing an 'a' element for the given page
Parameter Name | Type | Description |
---|---|---|
$page | \AbstractPage | page |
Returns: string HTML string (<a href="…">Label</a>)
Renders helper
Implements {@link HelperInterface::render()}.
Parameter Name | Type | Description |
---|---|---|
$container | \AbstractContainer|string|null | [optional] |
Returns: string
Renders the given $page as a link element, with $attrib = $relation
Parameter Name | Type | Description |
---|---|---|
$page | \AbstractPage | the |
$attrib | string | the |
$relation | string | relation |
Returns: string
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.
Parameter Name | Type | Description |
---|---|---|
$page | \AbstractPage |
Returns: \AbstractPage|array|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.
Parameter Name | Type | Description |
---|---|---|
$page | \AbstractPage |
Returns: \AbstractPage|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".
Parameter Name | Type | Description |
---|---|---|
$page | \AbstractPage |
Returns: \AbstractPage|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.
Parameter Name | Type | Description |
---|---|---|
$page | \AbstractPage |
Returns: \AbstractPage|array|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.
Parameter Name | Type | Description |
---|---|---|
$page | \AbstractPage |
Returns: \AbstractPage|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.
Parameter Name | Type | Description |
---|---|---|
$page | \AbstractPage |
Returns: \AbstractPage|array|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.
Parameter Name | Type | Description |
---|---|---|
$page | \AbstractPage |
Returns: \AbstractPage|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.
Parameter Name | Type | Description |
---|---|---|
$page | \AbstractPage |
Returns: \AbstractPage|null
Sets ACL to use when iterating pages
Implements {@link HelperInterface::setAcl()}.
Parameter Name | Type | Description |
---|---|---|
$acl | \Acl\AclInterface | ACL |
Returns: \AbstractHelper
Sets navigation container the helper operates on by default
Implements {@link HelperInterface::setContainer()}.
Parameter Name | Type | Description |
---|---|---|
$container | string|\Navigation\AbstractContainer | Default |
Returns: \AbstractHelper
Sets default ACL to use if another ACL is not explicitly set
Parameter Name | Type | Description |
---|---|---|
$acl | \Acl\AclInterface | [optional] |
Returns: void
Sets default ACL role(s) to use when iterating pages if not explicitly set later with {@link setRole()}
Parameter Name | Type | Description |
---|---|---|
$role | mixed | [optional] |
Returns: void
Set the event manager.
Parameter Name | Type | Description |
---|---|---|
$events | \EventManagerInterface |
Returns: \AbstractHelper
Set the indentation string for using in {@link render()}, optionally a number of spaces to indent with
Parameter Name | Type | Description |
---|---|---|
$indent | string|int |
Returns: \AbstractHelper
Sets the maximum depth a page can have to be included when rendering
Parameter Name | Type | Description |
---|---|---|
$maxDepth | int | Default |
Returns: \AbstractHelper
Sets the minimum depth a page must have to be included when rendering
Parameter Name | Type | Description |
---|---|---|
$minDepth | int | Default |
Returns: \AbstractHelper
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 = Links:RENDER_ALL ^ Links:RENDER_GLOSSARY;
$helper->setRenderFlag($flag);
// render only chapters and sections $flag = Links:RENDER_CHAPTER | Links:RENDER_SECTION; $helper->setRenderFlag($flag);
// render only relations that are not native W3C relations $helper->setRenderFlag(Links:RENDER_CUSTOM);
// render all relations (default) $helper->setRenderFlag(Links:RENDER_ALL);
Note that custom relations can also be rendered directly using the {@link renderLink()} method.
Parameter Name | Type | Description |
---|---|---|
$renderFlag | int |
Returns: \Links
Render invisible items?
Parameter Name | Type | Description |
---|---|---|
$renderInvisible | bool |
Returns: \AbstractHelper
Sets ACL role(s) to use when iterating pages
Implements {@link HelperInterface::setRole()}.
Parameter Name | Type | Description |
---|---|---|
$role | mixed | [optional] |
Returns: \AbstractHelper
Set the service locator.
Used internally to pull named navigation containers to render.
Parameter Name | Type | Description |
---|---|---|
$serviceLocator | \ContainerInterface |
Returns: \AbstractHelper
Sets whether ACL should be used
Implements {@link HelperInterface::setUseAcl()}.
Parameter Name | Type | Description |
---|---|---|
$useAcl | bool |
Returns: \AbstractHelper