depa/middleware-navigation 问题修复 & 功能扩展

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

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

depa/middleware-navigation

Composer 安装命令:

composer require depa/middleware-navigation

包简介

The middleware navigation is a PSR-15 middleware that provides navigation functionality to a Zend Expressive application

README 文档

README

Software License StyleCI Coverage Status

Installation

Run the following to install this library:

$ composer require depa/middleware-navigation

Documentation

After installing the module, you have to implement the navigation-middleware into your pipeline, so you basically add this line above the RouteMiddleware:

     $app->pipe(depa\NavigationMiddleware\Middleware\NavigationMiddleware::class);

To create a navigation, use the navigation.global.php (it's inside the config folder) as your basic (put it into config\autoload)

The basic structure of a menu-item must look like this:

'{navigation_Name}' => [
    'route' => '{route_name}', //route-name which is set in routes.php
]

if you want to add attributes to a menu-item (to the ul element), do this:

'{navigation_Name}' => [
    'attributes' => [...], //possibilitys in attributes-table described (at the bottom of the doc)
]

if you want to add link-attributes to a menu-item (to the a element), do this:

'{navigation_Name}' => [
    'linkAttributes' => [...], //possibilitys in link-attributes-table described (at the bottom of the doc)
]

if you want to add child-items to a menu-item, do this (you can use as many as you want):

'{navigation_Name}' => [
    'childs' => [...], //build the same as a normal menu-item
]

if you want to force a link-direction to an item then add this:

'{navigation_Name}' => [
    'uri' => '{https://www.designpark.de}',
]

a menu-item which contains any of the given examples could look like this:

'{navigation_Name}' => [
    'route' => '{route_name}',
    'uri' => '{https://www.designpark.de}',
    'attributes' => [
        'id' => '{some_id}',
        'class' => ['{class1} {class2}'],
    ],
    'linkAttributes' => [
        'id' => '{some_id}',
        'class' => '{class_1} {class2}',
    ],
    'childs' => [
        '{childNavigation_Name}' => [
            'route' => '{route_name}',
            'uri' => '{https://www.designpark.de}',
            'attributes' => [],
            'linkAttributes' => [],
            'childs' => [],
        ]
    ]
]

The example provided above would output the following HTML:

<ul>
    <li id="{some_id} class="{class1 class2} first last">
        <a href="{https://www.designpark.de}">{navigationName}</a>
        <ul class="menu_level_1">
            <li class="first last">
                <a href="{https://www.designpark.de}">{childNavigationName}</a>
            </li>
        </ul>
    </li>
</ul>

which would look like this:

  • {navigationName}
    • {childNavigationName}

Attributes you could use and what they do:

Attribute Description Example
Id Sets the id of the element 'id' => 'some_id'
class Sets the classes of the elements 'class' => 'class1 class2'

Link-Attributes you could use and what they do:

Attribute Description Example
Id Sets the id of the element 'id' => 'some_id'
Class Sets the classes of the element 'class' => 'class1 class2'
Target Sets the target-window of the element 'target' => '_blank'

we did not listed every link-/attribute, take a closer look at knpLabs/KnpMenu for more informations!

Credits

This bundle is inspired by Zend Framework. It has been developed by designpark.

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-05-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固