nzo/left-sidebar-bundle

NzoLeftSidebarBundle 是一个用于处理左侧边栏菜单的 Symfony Bundle。

安装: 22

依赖者: 0

建议者: 0

安全: 0

星标: 1

关注者: 1

分支: 0

开放问题: 0

类型:symfony-bundle

v0.2.5 2021-08-28 19:31 UTC

This package is auto-updated.

Last update: 2024-08-29 02:04:48 UTC


README

Build Status Latest Stable Version

NzoLeftSidebarBundle 是一个用于处理左侧边栏菜单的 Symfony Bundle。

本 Bundle 与 Symfony >= 4.4 兼容

安装

通过 Composer

$ composer require nzo/left-sidebar-bundle

在 config/bundles.php 中注册该 Bundle(不使用 Flex)

// config/bundles.php

return [
    // ...
    Nzo\LeftSidebarBundle\NzoLeftSidebarBundle::class => ['all' => true],
];

配置 Bundle

# config/packages/nzo_left_sidebar.yaml

nzo_left_sidebar:
    menu:
        user:
            label: Admin Users
            route_or_uri: /user                               # uri href
            icon: users
            cssClass: bn-danger
            role: ROLE_ADMIN
            accepted_environment_names: [prod, dev]   # optional
        article:
            label: Articles
            route_or_uri: article_index                       # route name
            icon: feather
            role: ROLE_USER
            children:
                article_foo:
                    label: Foo
                    route_or_uri: /foo
                    icon: fa fa-play-circle
                    role: ROLE_USER
                    children:
                        article_foo_bar:
                            label: bar
                            route_or_uri: foo/bar
                            icon: fa fa-video-camera
                            role: ROLE_USER
覆盖默认模板

可以覆盖默认模板

templates/
   └─ bundles/
      └─ NzoLeftSidebarBundle/
         └─ left-sidebar.html.twig

许可证

本 Bundle 采用 MIT 许可证。完整许可证见 Bundle 内部

查看 LICENSE