Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Bundle to handle editable cms slot on any page

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 CmsSlot
Octocat-spinner-32 Controller
Octocat-spinner-32 DependencyInjection
Octocat-spinner-32 Document
Octocat-spinner-32 Entity
Octocat-spinner-32 Model
Octocat-spinner-32 Resources
Octocat-spinner-32 Twig
Octocat-spinner-32 ElaoCmsSlotBundle.php
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.rst
Octocat-spinner-32 composer.json


ElaoCmsSlotBundle implements a low-level cms slot management. It allows you to integrate editable slots in your application.


Step 1: Download.

Download the bundle and put it under the Elao\CmsSlotBundle\ namespace.

Via composer:

// composer.json
    // ...
    "require": {
        // ...
        "elao/cms-slot-bundle": "dev-master"

Update your composer.phar:

$ php composer.phar update

Step 2: Register bundles with AppKernel.php.

Include it in your Kernel class:

// app/AppKernel.php
public function registerBundles()
    $bundles = array(
        new Elao\CmsSlotBundle\ElaoCmsSlotBundle(),


All features provided by the bundle are enabled by default when the bundle is registered in your Kernel class.

The default configuration is as follow:

System Message: ERROR/3 (<string>, line 54)

Unknown directive type "configuration-block".

.. configuration-block::

    .. code-block:: yaml

            db_driver:          orm             # or odm (not implemented yet)
            slot_provider:      serviceid       # Set a slot provider service
                                                # (or use the orm or odm default one if not set)
            i18n:               true            # enable or not culture dependent slots (translator service required)
            permission:         SLOT_EDITOR     # permissions needded to edit slot (security context service required)
              jeditable:                        # Configure jeditable slot types
                tinymce:                        # Configure Tinymce
                  enable:       true            # Enable tinymce
                  path:         /js/tinymce     # Set the tinymce path

db_driver: This option is just use to know wich default slot_provider to use if the slot_provider is not set. slot_provider: This options allows you to specify a slot provider service i18n: false by default. If this option is set. All slot name will be suffixed by the current locale. permission: Required permission to edit slots

Cms Slot Provider Service

Cms Slot Provider service must implement the CmsSlotProviderInterface. Given a slot code, it must return a CmsSlot object. The bundle comes with a default Cms Slot Provider (CmsSlotRepository).

Cms Slot Manager Service

Cms Slot Manager service is the central point of the bundle. His role is to: - Register Cms Slot Types - Interface with the Cms Slot Provider Service

Cms Slot Object

Cms Slot Objects are just objects to store slot's content.

Cms Slot Types

Cms Slot Types describe the way to display a slot content, and the way to edit a slot content. They must implements the CmsSlotTypeInterface. Cms Slot Types have two associated templates: One for displaying slot data (display mode), and one for editing the slot data (edit mode).

Cms Slot Types are tagged services (the tag is "elao.cms_slot.type" and accept to attributes: template_display and template_edit).

System Message: ERROR/3 (<string>, line 111)

Unknown directive type "configuration-block".

.. configuration-block::

    .. code-block:: xml
        <service id="elao.cms_slot.type.jeditable" class="%elao.cms_slot.type.jeditable.class%" public="false">
            <tag name="elao.cms_slot.type" template_display="ElaoCmsSlotBundle:CmsSlotType:jeditable_display.html.twig" template_edit="ElaoCmsSlotBundle:CmsSlotType:jeditable_edit.html.twig" />

The bundle comes by default with one Slot Type : jeditable

Cms Slot Twig Extension

The Twig extension allows you to integrate the slots in your apps by adding the twig function cms_slot(). The cms_slot() function takes 3 parameters: the slot type, the slot name and the slot parameters.


// Simple input text {{ cms_slot('jeditable', 'ABOUTUS_TEXT', {'type': 'text', 'width': '100%', 'height': '300'}) }}

// Simple textarea {{ cms_slot('jeditable', 'ABOUTUS_TEXT', {'type': 'textarea', 'width': '100%', 'height': '300'}) }}

// Will use tinymce {{ cms_slot('jeditable', 'ABOUTUS_TEXT', {'type': 'textarea', 'rich': true, 'width': '100%', 'height': '300'}) }}


  • Create odm classes
  • Create php templating helpers
Something went wrong with that request. Please try again.