cscfa/navbar-bundle 问题修复 & 功能扩展

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

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

cscfa/navbar-bundle

Composer 安装命令:

composer require cscfa/navbar-bundle

包简介

The NavBarBundle is a symfony2 navbar manager that use a Resources/config/navbar.yml file to manage navbar display

README 文档

README

Version: 1.0.5-dev

The NavBarBundle allow to create a navbar from navbar.yml files placed into the Resources/config directory.

#####Installation

Register the bundle into app/appKernel.php

// app/AppKernel.php
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            [...]
            new Cscfa\Bundle\NavBarBundle\CscfaNavBarBundle(),
        );
        
        [...]
    }
}

#####The navbar.yml file construction

The default place of the 'navbar.yml' file is into 'Resources/config' directory. It's possible to change this place by using the following configuration :

cscfa_nav_bar:
    files_path: "path"

note the given path must start with '/' and contain the complete file name. (example with the default configuration : '/Resources/config/navbar.yml')

######The file format is :

navbar:
	name:
		label: ""
		roles: []
		parent: ""
		path: {route: "", param: {}}
		url: ""
		options: mixed
		position: integer

The 'navbar' element is the root element.

The 'name' element is the identifyer of the navbar element, it can be used for define parent and will be used as label if 'label' is not defined.

The 'label' element is used as element text for rendering. It's an optional element.

The 'roles' element is used to render or not the element, according with the current user roles. It's an optional element.

The 'parent' element is used to define the parent element of the current for the rendering logic. It's an optional element.

The 'path' and 'url' elements are used to define the navbar element destination. The 'path' element is a generated application route with 'route' as route name and 'param' as route parameters. It's an optional element.

The 'options' element is used to send options to the render template. It's an optional element.

The 'position' element is used to set the position of the element into the navbar. It order the heads elements instead of childs inside their parents. note the default position can be set by the 'default_position' parameter of the configuration.

#####The template

Use twig function '{{ renderNavbar() }}' to display the navbar with the default template.

To use personnal template, use the app/config/config.yml with the following parameters:

cscfa_nav_bar:
    template: "bundleName:directory:template.html.twig"
    child_template: "bundleName:directory:template.html.twig"

The 'template' parameter define the root template of the navbar. The template receive the navbar element into the 'element' variable.

The 'child_template' parameter define the rendered template for each elements of the navbar. This template receive a child into 'element' variable and the navbar nesting level into 'nestedLevel' variable.

#####Use cache

By default, the navbar loader will use cache to store the builded navbar. Configure with the following in 'app/config/config.yml' :

cscfa_nav_bar:
    cache:
		enable: true|false
		id:		'the_cache_id'

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-12-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固