amnav

Navigation plugin for Craft

  • 所有者: am-impact/amnav
  • 平台:
  • 許可證:
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

a&m nav

Navigations in Craft, made easy

Functionality

In the plugin's settings you can adjust the plugin's name for your customers and disable adding, editing and deleting navigations for non-admins.

Settings

The navigations overview.
If you disabled the Can add, edit and delete setting in the plugin's settings, non-admins will only see the created navigations and the link to start building their navigation.

Navigations

When you create or edit a navigation, you can set the following settings:, Setting, Explanation, ---------, -----------, Max Levels, The maximum number of levels this navigation can have. Leave blank if you don’t care., Can move from level, Whether non-admins can move nodes from a specific level. Leave blank if you don’t care., Can delete from level, Whether non-admins can delete nodes from a specific level. Leave blank if you don’t care., Edit

Let's start building a navigation!
Non-admins don't see the Display navigation section. This is for admins only so they know what to put in the templates.
You have the option to add existing entries, categories, assets or..

Build

.. add your own URLs.

Your own URL

When you have saved your nodes in the navigation, you can edit them later by double clicking on the node, or use the setting button behind the node when you hover over a node.

Edit node

Variables

You have two ways to fetch your navigation. You can get an array with your added nodes, or let a&m nav create the HTML for you.

{% set nav = craft.amNav.getNavRaw("yourNavigationHandle") %}

or

{{ craft.amNav.getNav("yourNavigationHandle") }}

Build the way you like it

Now you can add your own HTML if necessary!

{% set nav = craft.amNav.getNavRaw("yourNavigationHandle") %}

{% macro addNodeToNavigation(node, index) %}
    {%- set nodeClasses = [] -%}
    {%- if node.hasChildren -%}
        {%- set nodeClasses = nodeClasses, merge(['has-children']) -%}
    {%- endif -%}
    {%- if node.active or node.hasActiveChild -%}
        {%- set nodeClasses = nodeClasses, merge(['active']) -%}
    {%- endif -%}
    {%- if node.level == 1 and index == 1 -%}
        {%- set nodeClasses = nodeClasses, merge(['first']) -%}
    {%- endif -%}
    {%- if node.listClass, length -%}
        {%- set nodeClasses = nodeClasses, merge([node.listClass]) -%}
    {%- endif -%}

    <li{% if nodeClasses, length %} class="{{ nodeClasses, join(' ') }}"{% endif %}>
        <a href="{{ node.url }}" title="{{ node.name }}"{% if node.blank %} target="_blank"{% endif %}>{{ node.name }}</a>
        {% if node.hasChildren %}
            <ul class="nav__level{{ (node.level + 1) }}">
                {% for subnode in node.children %}
                    {{ _self.addNodeToNavigation(subnode, loop.index) }}
                {% endfor %}
            </ul>
        {% endif %}
    </li>
{% endmacro %}

<nav class="navmain">
    <ul class="nav">
        {% for node in nav %}
            {{ _self.addNodeToNavigation(node, loop.index) }}
        {% endfor %}
    </ul>
</nav>

Parameters, Parameter, Explanation, ---------, -----------, maxLevel, Build the navigation till a certain level., overrideStatus, Includes every node whatever the status., startFromId, Begin the navigation at a specific node ID., ## Let amnav do the trick

{{ craft.amNav.getNav("yourNavigationHandle") }}

or with parameters..

{{ craft.amNav.getNav("yourNavigationHandle", {
    id: 'navigation',
    class: 'navigation'
}) }}

Breadcrumbs are not based on a created navigation. They are based on the current URL segments.

{{ craft.amNav.getBreadcrumbs() }}

or with parameters..

{{ craft.amNav.getBreadcrumbs({
    id: 'breadcrumbs',
    class: 'breadcrumbs'
}) }}

Parameters, Parameter, Explanation, ---------, -----------, id, ID for the breadcrumbs wrapper., class, Class name for the breadcrumbs wrapper., classDefault, Default class name for every breadcrumb., classFirst, Class name for the first breadcrumb., classLast, Class name for the last breadcrumb., wrapper, Wrapper element without the < and >., beforeText, Text before the first item, like 'You are here:'., renameHome, Change the title of the home entry., lastIsLink, Whether the last breadcrumb should be a link., ## Contact

If you have any questions, suggestions or noticed any bugs, don't hesitate to contact us.

主要指標

概覽
名稱與所有者am-impact/amnav
主編程語言PHP
編程語言PHP (語言數: 4)
平台
許可證
所有者活动
創建於2014-10-07 07:10:25
推送於2017-10-18 09:22:45
最后一次提交2017-05-05 14:30:39
發布數36
最新版本名稱1.8.0 (發布於 )
第一版名稱1.0 (發布於 )
用户参与
星數169
關注者數16
派生數20
提交數141
已啟用問題?
問題數85
打開的問題數18
拉請求數10
打開的拉請求數2
關閉的拉請求數6
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?