This bundle provides localized content management

2.4.1 2014-04-25 08:26 UTC


Build Status Latest Stable Version Total Downloads

License here.

What is Arcana Content Bundle?

Arcana Content Bundle allows administrators to edit texts directly in the page, not some separate Admin section.



Bundle can be installed via Composer. You can find this bundle on packagist:

// composer.json
    // ...
    require: {
        // ..
        "arcanacode/content-bundle": "dev-master"


Then, you can install the new dependencies by running Composer's update command from the directory where your composer.json file is located:

    php composer.phar update

You have to add this bundle to AppKernel.php register bundles method, so that Symfony can use it.

// in AppKernel::registerBundles()
$bundles = array(
    // ...
    new Arcana\Bundle\ContentBundle\ArcanaContentBundle(),

In your config.yml you must add this bundle to jms_di_extra.

        bundles: [ ArcanaContentBundle ]

Next add bundle to the 'app/config/routing.yml' file.

    resource: "@ArcanaContentBundle/Controller/"
    type:     annotation

In base template file include stylesheets and javascripts for only users with ROLE_ADMIN

{% if is_granted('ROLE_ADMIN') %}
    {% stylesheets filter="cssrewrite"
    {% endstylesheets %}
{% endif %}
{% if is_granted('ROLE_ADMIN') %}
    {% javascripts
    {% endjavascripts %}

{% endif %}

Put somewhere in your base template

window.arcana_content_manager.contentSaveUrl = '{{ path('arcana_content_save') }}';

In your security.yml file restrict access for arcana_content_save path only to administrators.

    - { path: ^/save, roles: ROLE_ADMIN }

Finally run app/console doctrine:schema:update --force to create 'content' table in your database.


In order to use the bundle, all texts you want to be able to edit, must be added to template with content filter in such format:

{{ 'default value' | content('name', {options}) }}

'default value' is the default text, that will appear if no content is found in database. 'name' is the name of content in the content table. 'options' - array of options (listed below). Example:

{{ 'Welcome to the Arcana Content Bundle!' | content('default_page_title', { editable_separately: true, type: 'plaintext' }) }}

You can also use large text blocks (also with html tags) without using a default value, for example:

{% content of "facts_text" %}
            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc rhoncus massa et dui tempor facilisis. In a luctus erat. Morbi eget tellus fermentum, pretium arcu sed, congue arcu. 
{% endcontent %}

Separately editable texts

{{ 'You can edit me separately' | content('separate_title_tag', { editable_separately: true, type: 'plaintext' }) }}

Separately editable texts are texts, that are not visible on the page, for example "title" tag. You can edit them by opening "Separately editable contents" popup.

Options available: 'editable_separately' - if 'true', will be editable in separately editable contents popup 'type': 'plaintext'/'block'/'inline'/'anchor' - NEED DESCRIPTION


Pull requests are welcome.

Description here.

Running Symfony2 Tests

Description here.