Links
Links are stream entries that belong to a menu. Links use extensions called link type extensions
to define how they work.
Link Fields
Below is a list of fields
in the links
stream. Fields are accessed as attributes:
$link->title;
Same goes for decorated instances in Twig:
{{ link.title }}
Fields
Key | Required | Type | Default | Description |
---|---|---|---|---|
menu |
true |
relationship |
none |
The related menu. |
type |
true |
addon |
none |
The link type extension. |
entry |
true |
polymorphic |
none |
The related link information per link type. |
target |
true |
select |
none |
The link's target attribute. |
class |
false |
text |
null |
The link class. |
parent |
false |
relationship |
null |
The related parent link. |
allowed_roles |
false |
multiple |
null |
The user roles allowed to view the link. |
Link Interface
This section will go over the \Anomaly\NavigationModule\Link\Contract\LinkInterface
class.
LinkInterface::getUrl()
The getUrl
method returns the link's URL via it's extension
.
Returns: string
Example
$link->getUrl();
Twig
{{ link.getUrl() }}
LinkInterface::getTitle()
The getTitle
returns the link title via it's extension
.
Returns: string
Example
$link->getTitle();
Twig
{{ link.getTitle() }}