harentius/widgets-bundle

此包已被废弃且不再维护。没有建议的替代包。

Symfony Bundle,用于轻松创建和管理客户端小部件

安装: 162

依赖者: 0

建议者: 0

安全: 0

星标: 1

关注者: 1

分支: 0

开放问题: 0

类型:symfony-bundle

v1.0.2 2017-06-13 19:55 UTC

This package is auto-updated.

Last update: 2022-04-29 00:46:47 UTC


README

Symfony Bundle,用于轻松创建和管理客户端小部件。具有 SonataAdminBundle 依赖并提供管理功能。

安装

$ composer.phar require harentius/widgets-bundle
  1. 在内核中启用包
<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Harentius\WidgetsBundle\HarentiusWidgetsBundle(),
    );

    // ...
}
  1. 包含配置
imports:
    ....
    - { resource: "@HarentiusWidgetsBundle/Resources/config/config.yml" }
  1. 配置
harentius_widgets:
    # List of routes, where widgets can be placed
    routes:
        acme_homepage:
            # User-friendly name for displaying in admin section (sonata)
            name: Homepage
        acme_blog_show:
            name: Article
            # Parameters, present in route
            parameters:
                slug:
                    # Source (Now only entity supported)
                    source:
                        class: HarentiusBlogBundle:Article
                        # Value to be passed to the route 
                        field: slug
                        # Value to be shown in admin section
                        identity: title
    # Registering widgets: key used in templates (look behind), value - shown in admin section
    widgets:
        widgets_block_sidebar: Sidebar
        widgets_block_bottom_left: Bottom left
        widgets_block_bottom_right: Bottom right
  1. 放置在您想要的模板中
    {{ harentius_widget('widgets_block_sidebar') }}
    ....
    {{ harentius_widget('widgets_block_bottom_left') }}
    ....
    {{ harentius_widget('widgets_block_bottom_right') }}