English spoken conference
WARNING: You are browsing the documentation for version 1.2 which is not maintained anymore. If some of your projects are still using this version, consider upgrading.

Configuration Reference

1.2 version

Configuration Reference

The CoreBundle can be configured under the cmf_core key in your application configuration. When using XML, you can use the http://cmf.symfony.com/schema/dic/core namespace.

Configuration

persistence

phpcr

This defines the persistence driver. The default configuration of persistence is the following configuration:

  • YAML
    1
    2
    3
    4
    5
    6
    7
    8
    9
    cmf_core:
        persistence:
            phpcr:
                enabled:              false
                basepath:             /cms
                manager_registry:     doctrine_phpcr
                manager_name:         ~
                use_sonata_admin:     auto
                translation_strategy: ~
    
  • XML
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    <?xml version="1.0" charset="UTF-8" ?>
    <container xmlns="http://symfony.com/schema/dic/services">
    
        <config xmlns="http://cmf.symfony.com/schema/dic/core">
            <persistence>
                <phpcr
                    enabled="false"
                    basepath="/cms"
                    manager-registery="doctrine_phpcr"
                    manager-name="null"
                    use-sonata-admin="auto"
                    translation-strategy="null"
                />
            </persistence>
        </config>
    
    </container>
    
  • PHP
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    $container->loadFromExtension('cmf_core', array(
        'persistence' => array(
            'phpcr' => array(
                'enabled'              => false,
                'basepath'             => '/cms/simple',
                'manager_registry'     => 'doctrine_phpcr',
                'manager_name'         => null,
                'use_sonata_admin'     => 'auto',
                'translation_strategy' => null,
            ),
        ),
    ));
    

orm

This defines the persistence driver. The default configuration of persistence is the following configuration:

  • YAML
    1
    2
    3
    4
    5
    6
    cmf_core:
        persistence:
            orm:
                enabled:          false
                manager_name:     ~
                use_sonata_admin: auto
    
  • XML
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    <?xml version="1.0" charset="UTF-8" ?>
    <container xmlns="http://symfony.com/schema/dic/services">
    
        <config xmlns="http://cmf.symfony.com/schema/dic/core">
            <persistence>
                <phpcr
                    enabled="false"
                    manager-name="null"
                    use-sonata-admin="auto"
                />
            </persistence>
        </config>
    
    </container>
    
  • PHP
    1
    2
    3
    4
    5
    6
    7
    8
    9
    $container->loadFromExtension('cmf_core', array(
        'persistence' => array(
            'phpcr' => array(
                'enabled'          => false,
                'manager_name'     => null,
                'use_sonata_admin' => 'auto',
            ),
        ),
    ));
    
enabled

type: boolean default: false

If true, PHPCR is enabled in the service container.

If the CoreBundle is registered, this will default to the value of cmf_core.persistence.phpcr.enabled.

PHPCR can be enabled by multiple ways such as:

  • YAML
    1
    2
    3
    4
    5
    6
    phpcr: ~ # use default configuration
    # or
    phpcr: true # straight way
    # or
    phpcr:
        manager: ... # or any other option under 'phpcr'
    
  • XML
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    <persistence>
        <!-- use default configuration -->
        <phpcr />
    
        <!-- or setting it the straight way -->
        <phpcr>true</phpcr>
    
        <!-- or setting an option under 'phpcr' -->
        <phpcr manager="..." />
    </persistence>
    
  • PHP
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    $container->loadFromExtension(..., array( // bundle configuration key, e.g. cmf_menu
        // ...
        'persistence' => array(
            'phpcr' => null, // use default configuration
            // or
            'phpcr' => true, // straight way
            // or
            'phpcr' => array(
                'manager' => '...', // or any other option under 'phpcr'
            ),
        ),
    ));
    

Enabling this setting will also automatically enable the equivalent setting in the following Bundles:

basepath

type: string default: /cms/

The basepath for CMS documents in the PHPCR tree.

Enabling this setting will also automatically enable the equivalent settings in the following Bundles:

manager_registry

type: string default: doctrine_phpcr

Enabling this setting will also automatically enable the equivalent settings in the following Bundles:

manager_name

type: string default: null

The name of the Doctrine Manager to use. null tells the manager registry to retrieve the default manager.<persistence>

Enabling this setting will also automatically enable the equivalent setting in the following Bundles:

use_sonata_admin

type: enum valid values: true|false|auto default: auto

If true, the admin classes for SimpleCmsBundle pages are activated. If set to auto, the admin services are activated only if the SonataPhpcrAdminBundle is present.

Enabling this setting will also automatically enable the equivalent setting in the following Bundles:

translation_strategy

type: string default: null

This setting can be used to force a specific translation strategy for all documents.

multilang

This configures whether multiple languages mode should be activated.

If the multilang option is not defined at all, the CoreBundle registers a listener for Doctrine PHPCR-ODM that modifies PHPCR-ODM metadata to remove the translatable attribute from all fields.

If multilang is enabled, the TranslatableExtension for SonataAdminBundle is enabled and the locales will be configured on all CMF bundles that use this configuration:

  • YAML
    1
    2
    3
    cmf_core:
        multilang:
            locales: [en, fr]
    
  • XML
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    <?xml version="1.0" charset="UTF-8" ?>
    <container xmlns="http://symfony.com/schema/dic/services">
    
        <config xmlns="http://cmf.symfony.com/schema/dic/core">
            <multilang>
                <locale>en</locale>
                <locale>fr</locale>
            </multilang>
        </config>
    </container>
    
  • PHP
    1
    2
    3
    4
    5
    6
    7
    8
    $container->loadFromExtension('cmf_core', array(
        'multilang' => array(
            'locales' => array(
                'en',
                'fr',
            ),
        ),
    ));
    

locales

type: array default: null

This define languages that can be used.

publish_workflow

This configures whether the publish workflow should be enabled, which service to use and what role may view content not yet published. The request listener ensures only published routes and content can be accessed.

  • YAML
    1
    2
    3
    4
    5
    6
    cmf_core:
        publish_workflow:
            enabled:                 true
            checker_service:         cmf_core.publish_workflow.checker.default
            view_non_published_role: ROLE_CAN_VIEW_NON_PUBLISHED
            request_listener:        true
    
  • XML
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    <?xml version="1.0" charset="UTF-8" ?>
    <container xmlns="http://symfony.com/schema/dic/services">
    
        <config xmlns="http://cmf.symfony.com/schema/dic/core">
            <publish-workflow
                enabled="true"
                checker-service="cmf_core.publish_workflow.checker.default"
                view-non-published-role="ROLE_CAN_VIEW_NON_PUBLISHED"
                request-listener="true"
            />
        </config>
    </container>
    
  • PHP
    1
    2
    3
    4
    5
    6
    7
    8
    $container->loadFromExtension('cmf_core', array(
        'publish_workflow' => array(
            'enabled'                 => true,
            'checker_service'         => 'cmf_core.publish_workflow.checker.default',
            'view_non_published_role' => 'ROLE_CAN_VIEW_NON_PUBLISHED',
            'request_listener'        => true,
        ),
    ));
    

Sonata Admin

This section configures the Sonata Admin Extensions, see:

  • YAML
    1
    2
    3
    4
    5
    6
    7
    8
    9
    cmf_core:
        sonata_admin:
            extensions:
                publishable:
                    form_group: form.group_publish_workflow
                publish_time:
                    form_group: form.group_general
                translatable:
                    form_group: form.group_general
    
  • XML
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    <?xml version="1.0" charset="UTF-8" ?>
    <container xmlns="http://symfony.com/schema/dic/services">
    
        <config xmlns="http://cmf.symfony.com/schema/dic/core">
            <sonata-admin>
                <extension>
                    <publishable form-group="form.group_publish_workflow" />
                    <publish-time form-group="form.group_general" />
                    <translatable form-group="form.group_general" />
                </extension>
            </sonata-admin>
        </config>
    </container>
    
  • PHP
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    $container->loadFromExtension('cmf_core', array(
        'sonata_admin' => array(
            'extensions' => array(
                'publishable' => array(
                    'form_group' => 'form.group_publish_workflow',
                ),
                'publish_time' => array(
                    'form_group' => 'form.group_general',
                ),
                'translatable' => array(
                    'form_group' => 'form.group_general',
                ),
            ),
        ),
    ));
    

form_group

type: string default: as in above example.

Defines which form group the fields from this extension will appear in within the Sonata Admin edit interface.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.