Plugin

This section will go over how to use the plugin that comes with the Navigation module.

menu

The menu function let's you generate navigation structure based on the specified navigation menu.

The returned plugin criteria will render the resulting navigation automatically using __toString() if you do not explicitly call render().

Returns: \Anomaly\Streams\Platform\Addon\Plugin\PluginCriteria
Arguments
Key Required Type Default Description

$root

false

mixed

none

The id, instance, or path of the root navigation link.

Twig
{{ menu()|raw }}

{# Showing child navigation #}
{{ menu('about')
    .linkAttributesDropdown({'data-toggle': 'dropdown'})
    .listClass('nav navbar-nav navbar-right')
    .childListClass('dropdown-menu')
    .render()|raw }}
Available Options

The menu function uses the plugin criteria to allow you to configure options for the resulting navigation.

Options are defined by chaining together camelCase methods:

{{ menu().optionOne('example')|raw }} // Results in option_one = example

So to define dropdown_class for example you would do this:

{{ menu().dropdownClass('dropdown')|raw }}

Defining criteria options this way is standard throughout Pyro!{.tip}

Options
Key Required Default Description

view

false

anomaly.module.navigation::links

The base view to render the navigation from.

macro

false

anomaly.module.navigation::macro

The macro to use for rendering the navigation.

depth

false

none

The maximum depth of the navigation.

list_tag

false

ul

The list tag to use.

list_class

false

none

The list class to use.

item_tag

false

li

The list item tag to use.

item_class

false

none

The list item class to use.

dropdown_class

false

dropdown

The CSS class for links containing child links.

active_class

false

active

The CSS class for links that are selected or whose child link is selected.

selected_class

false

current

The CSS class for the currently selected navigation link.

link_class

false

none

The CSS class to use for links.

link_attributes

false

[]

An array of key value html attributes for links.

link_attributes_dropdown

false

[]

An array of key value html attributes for links that have a dropdown.

child_list_tag

false

list_tag

The list tag for child lists.

child_list_class

false

none

The list class for child lists.

dropdown_toggle

false

none

The dropdown toggle tag to use in the case a dropdown toggle is desired.

dropdown_toggle_class

false

none

The dropdown toggle class to use in the case a dropdown toggle is desired.

dropdown_toggle_attributes

false

[]

An array of key value html attributes for the dropdown toggle.

dropdown_toggle_text

false

none

The text or HTML to display inside the dropdown toggle.

links

The links function returns the links in a specified menu.

To return the collection of links use the get() trigger on the plugin criteria (see example below).

Returns: \Anomaly\NavigationModule\Link\LinkCollection
Arguments
Key Required Type Default Description

$menu

true

string

none

The slug of the menu to return links for.

Twig
{% for link in links('footer').get() %}
<p>
    <a href="{{ link.url }}" target="{{ link.target.key }}">{{ link.title }}</a>
</p>
{% endfor %}
Available Options

The links function uses the plugin criteria to allow you to configure options for the resulting navigation.

Options are defined by chaining together camelCase methods:

{{ links().optionOne('example')|raw }} // Results in option_one = example

So to define dropdown_class for example you would do this:

{{ links().dropdownClass('dropdown')|raw }}

Defining criteria options this way is standard throughout Pyro!{.tip}

Options
Key Required Default Description

root

false

none

The id or path of the root link to start navigation from.