Skip to content
Symfony Bundle for easy creating and managing client-side widgets
PHP CoffeeScript HTML CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Admin
Controller
DependencyInjection
Doctrine
Entity
Form/Type
Resources
Twig
.gitignore
HarentiusWidgetsBundle.php
README.md
composer.json

README.md

Widgets Bundle

Symfony Bundle for easy creating and managing client-side widgets. Has SonataAdminBundle dependency and provide management.

Installation

$ composer.phar require harentius/widgets-bundle
  1. Enable bundle in the kernel:
<?php
// app/AppKernel.php

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

    // ...
}
  1. Include configuration:
imports:
    ....
    - { resource: "@HarentiusWidgetsBundle/Resources/config/config.yml" }
  1. Configure:
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. Place in templates where you want:
    {{ harentius_widget('widgets_block_sidebar') }}
    ....
    {{ harentius_widget('widgets_block_bottom_left') }}
    ....
    {{ harentius_widget('widgets_block_bottom_right') }}
You can’t perform that action at this time.