k4/k4navigation 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

k4/k4navigation

Composer 安装命令:

composer require k4/k4navigation

包简介

Advanced navigation and breadcrumb Plugin (Twig filter) for Craft CMS 3.x

README 文档

README

Craft Plugin Twig filter for advanced navigations in Craft CMS.

Screenshot

Installation

To install k4navigationCraft3, follow these steps:

  1. Install with Composer via composer require k4/k4navigation from your project directory.

k4navigation works with Craft 3.0 or later.

k4navigation Overview

Twig filter for advanced navigations in Craft CMS.

Using k4navigation

First, set your Menu in craft.

{% set entries = craft.entries()
  .section('pages')
  .level(1)
  .with(['descendants'])
  .all() 
%}

{% set mainnavigation %}

    {% for entry in entries %}
        <li>
            <a href="{{ entry.url }}">
                {{ entry.title }}
                {% if entry.hasDescendants %}
                    <i class="fas fa-caret-down"></i>
                {% endif %}
            </a>
            {% nav node in entry.descendants %}
                ...
            {% endnav %}
        </li>
    {% endfor %}

{% endset %}

Now you can use the k4-navigation twig filter. See the examples below:

Simple add class "active" to all Parent-Elements of selected item

    {{ mainnavigation | k4NavigationGetActivePath(url(craft.app.request.pathInfo)) | raw }}

Simple Menu shows only first level and also selected path

    {{ mainnavigation | k4NavigationGetSimpleNavigation(url(craft.app.request.pathInfo)) | raw }}

Show Breadcrumb for menu

    {{ mainnavigation | k4NavigationGetBreadcrumb(url(craft.app.request.pathInfo)," > ") | raw }}

Generate Navigation menu with first level navigation only

    {{ mainnavigation | k4NavigationGetFirstNavOnly(craft.app.request.absoluteUrl) | raw }}

Generate Navigation menu excluding first level items (submenu only)

    {{ mainnavigation | k4NavigationGetSubNavOnly(craft.app.request.absoluteUrl) | raw }}

Brought to you by Thomas Bauer

统计信息

  • 总下载量: 544
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固