byte-artist/menu-bundle 问题修复 & 功能扩展

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

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

byte-artist/menu-bundle

Composer 安装命令:

composer require byte-artist/menu-bundle

包简介

Provides a configurable symfony and twig compatible menu for frontend application

README 文档

README

menu-bundle is a symfony bundle to display a menu according to the configuration stored in menu.yaml. routes stored under path and known to the system are recognized and displayed as "active", if this page is currently active. labels of the menu items are translated if they are stored in the translations.

Installation

Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.

Applications that use Symfony Flex

Open a command console, enter your project directory and execute:

$ composer require byte-artist/menu-bundle

Applications that don't use Symfony Flex

Step 1: Install the Bundle

Open a command console, enter your project directory and execute the following command to install the latest stable version of this bundle:

$ composer require byte-artist/menu-bundle

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the config/bundles.php file of your project:

// config/bundles.php

return [
    // ...
    ByteArtist\MenuBundle\MenuBundle::class => ['all' => true],
];

Configuration

Example:

menu:
    type: default
    brand_name: Brand Name
    use_orig_css: true
    use_orig_js: true
    pages:
        label_home:
            path: existing_route
        label_user:
            path: label_user_index
            pages:
                label_user_create:
                    path: route_user_create
                label_user_edit:
                    path: route_user_edit
        label_admin:
            path: #
            pages:
                label_admin_overview:
                    path: route_admin_index
                label_admin_edit:
                    path: route_admin_edit
        label_contact:
            path: route_content
        label_imprint: https://www.byte-artist.de/imprint
  • type: possible types: div, list, bootstrap and default (default is list)
  • brand_name: Brand name which is displayed in the bootstrap menu (bootstrap type only)
  • use_orig_css: Flag to control whether the css code delivered with the bundle should be used, if false, you have to provide it yourself
  • use_orig_js: Flag to control whether the javascript code delivered with the bundle should be used, if false, you have to provide it yourself
  • pages: list of the structure belonging to the menu
    • route_name: name of the menu item, if it exists in the translations it will be translated, otherwise the item will just be displayed as specified here

      [

      • path: name to an existing route of an action, a normal url or just a '#' is also possible.
      • pages: optional, any subpages

      ]

Usage

To display the menu, it is sufficient to call the Twig function menu in a Twig template, wherever it is to be displayed:

// layout.html.twig
{{ menu() }}

Troubleshooting

if for some reason the symfony repository for the contrib recipes is not available, add the following lines in your composer.json:

"extra": {
    "symfony": {
        "endpoint": [
            "https://api.github.com/repos/mastercad/symfony-recipes/contents/index.json",
            "flex://defaults"
        ]
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-01-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固