定制 altamash80/laminas-mvc-bootstrap-menu 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

altamash80/laminas-mvc-bootstrap-menu

最新稳定版本:v1.2.0

Composer 安装命令:

composer require altamash80/laminas-mvc-bootstrap-menu

包简介

This repository can generate nested bootstrap menu based on ul li tag. More may come later. Thanks!

README 文档

README

This repository will contain bootstrap menu integration with laminas-mvc

Pre-Requisites

You need to have bootstrap css and js files included in your layout.phtml. If not, you can still be able to see the generated html.

Introduction

This package generates a bootstrap menu based on the configuration given in your application. Which should be compatible with Laminas-Navigation. Because this package extends Laminas-Navigation therefore the configuration should match with Laminas-Navigation. This package came into existence with the help of Frank Brückner. Thanks for the help Frank Brückner. My first contribution to Laminas MVC.

Installation using Composer

composer require altamash80/laminas-mvc-bootstrap-menu

Registering the modules in your application

<?php
return [
    'modules' => [
        // ...
        'Laminas\Navigation', // <-- Add this line if not present
        'LRPHPT', // <-- Add this line in your root_path/config/modules.config.php file
        'Application',
    ],
];

Menu Container Array

<?php

// Application/config/module.config.php
return [

    // ...
    'navigation' => [
      'default' => [
        'home' => [
           'label' => 'Home',
           'route' => 'home',
           'resource' => 'home',
        ],
        'category' => [
          'label' => 'Category',
          'uri' => '#',
          'pages' => [
            'php' => [
              'label' => 'PHP',
              'uri' => 'https://www.php.net',
            ],
            'laminas' => [
              'label' => 'Laminas',
              'uri' => 'https://getlaminas.org/',
              'resource' => 'lmcuser',
            ],
            'devider' => [
               'label' => '--devider--', // most important
               'uri' => '#',
            ],
            'magento' => [
              'label' => 'Magento',
              'uri' => 'https://business.adobe.com/products/magento/magento-commerce.html',
            ],
          ],
        ]
      ]
    ],
];

Usage in MVC View

<?=$this->navigation('default')
                    ->bootstrapMenu()
                    ->setUlClass('navbar-nav')
                    // Optional setting to use with LmcRbac route guard.
                    ->setAuthorizationService($this->LmcRbacAuthorizationServiceHelper())
                    ; ?>

HcOffCanvas Menu

<?php

// Application/config/module.config.php
use LRPHPT\Navigation\Page as LrphptPage;

return [

    // ...
    'navigation' => [
      'default' => [
        'home' => [
           'label' => 'Home',
           'route' => 'home',
           'liClass' => 'collections',
           'type' => LrphptPage\MvcPage::class,
        ],
        'cryptocurrency' => [
          'label' => 'Cryptocurrency',
          'type' => LrphptPage\UriPage::class,
          'liClass' => 'cryptocurrency',
          'uri' => 'https://www.google.com/search?q=Crypto',
          'pages' => [
            'bitcoin' => [
              'label' => 'Bitcoin',
              'uri' => 'https://www.php.net',
              'type' => LrphptPage\UriPage::class,
            ],
            'ethereum' => [
              'label' => 'Ethereum',
              'uri' => 'https://getlaminas.org/',
              'type' => LrphptPage\UriPage::class,
            ],
          ],
        ],
        'devices' => [
          'label' => 'Devices',
          'type' => LrphptPage\UriPage::class,
          'liClass' => 'devices',
          'uri' => '#',
          'type' => LrphptPage\UriPage::class,
          'pages' => [
            'mobile' => [
              'label' => 'Mobile Phones',
              'uri' => '#',
              'liClass' => 'mobile',
              'type' => LrphptPage\UriPage::class,
              'pages' => [
                'mobile1' => [
                  'label' => 'Super Smart Phone',
                  'uri' => '#',
                  'type' => LrphptPage\UriPage::class,
                ],
                'mobile2' => [
                  'label' => 'Thin Magic Mobile',
                  'uri' => '#',
                  'type' => LrphptPage\UriPage::class,
                ],
                'mobile3' => [
                  'label' => 'Performance Crusher',
                  'uri' => '#',
                  'type' => LrphptPage\UriPage::class,
                ],
              ],
            ],
            'television' => [
              'label' => 'Television',
              'uri' => '#',
              'liClass' => 'television',
              'type' => LrphptPage\UriPage::class,
              'pages' => [
                'television1' => [
                  'label' => 'Flat Superscreen',
                  'uri' => '#',
                  'type' => LrphptPage\UriPage::class,
                ],
                'television2' => [
                  'label' => 'Gigantic LED',
                  'uri' => '#',
                  'type' => LrphptPage\UriPage::class,
                ],
                'television3' => [
                  'label' => '3D Experience',
                  'uri' => '#',
                  'type' => LrphptPage\UriPage::class,
                ],
              ],
            ],
            'camera' => [
              'label' => 'Cameras',
              'uri' => '#',
              'liClass' => 'camera',
              'type' => LrphptPage\UriPage::class,
              'pages' => [
                'camera1' => [
                  'label' => 'Smart Shot',
                  'uri' => '#',
                  'type' => LrphptPage\UriPage::class,
                ],
                'camera2' => [
                  'label' => 'Power Shooter',
                  'uri' => '#',
                  'type' => LrphptPage\UriPage::class,
                ],
                'camera3' => [
                  'label' => 'Easy Photo Maker',
                  'uri' => '#',
                  'type' => LrphptPage\UriPage::class,
                ],
              ],
            ],
          ],
        ],
        'magazines' => [
          'label' => 'Magazines',
          'uri' => '#',
          'liClass' => 'magazines',
          'type' => LrphptPage\UriPage::class,
          'pages' => [
            'magazines1' => [
              'label' => 'National Geographic',
              'uri' => '#',
              'type' => LrphptPage\UriPage::class,
            ],
            'magazines2' => [
              'label' => 'Scientific American',
              'uri' => '#',
              'type' => LrphptPage\UriPage::class,
            ],
            'magazines3' => [
              'label' => 'The Spectator',
              'uri' => '#',
              'type' => LrphptPage\UriPage::class,
            ],
          ],
        ],
      ]
    ],
];

Usage in MVC View

<?=$this->navigation('default')
                    ->hcOffCanvasMenu()
                    ->setUlClass('first-nav')
                    // Optional setting to use with LmcRbac route guard.
                    ->setAuthorizationService($this->LmcRbacAuthorizationServiceHelper())
                    ; ?>

hcoffcanvas

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2022-09-14