Configuration Reference

1.3 version
Maintained Unmaintained
1.2

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

Some configuration settings set on the CoreBundle are forwarded as default configuration to all CMF bundles that are installed in your application. This is explicitly listed below for each configuration option that is forwarded.

persistence

phpcr

This enables the persistence driver for the PHP content repository. The default configuration is the following:

  • YAML
    1
    2
    3
    4
    5
    6
    7
    8
    9
    # app/config/config.yml
    cmf_core:
        persistence:
            phpcr:
                enabled:              false
                basepath:             /cms
                manager_registry:     doctrine_phpcr
                manager_name:         ~
                translation_strategy: ~
    
  • XML
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    <!-- app/config/config.xml -->
    <?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"
                    translation-strategy="null"
                />
            </persistence>
        </config>
    
    </container>
    
  • PHP
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    // app/config/config.php
    $container->loadFromExtension('cmf_core', [
        'persistence' => [
            'phpcr' => [
                'enabled'              => false,
                'basepath'             => '/cms/simple',
                'manager_registry'     => 'doctrine_phpcr',
                'manager_name'         => null,
                'translation_strategy' => null,
            ],
        ],
    ]);
    

orm

This enables the persistence driver for relational databases. The default configuration is the following:

  • YAML
    1
    2
    3
    4
    5
    6
    # app/config/config.yml
    cmf_core:
        persistence:
            orm:
                enabled:          false
                manager_name:     ~
    
  • XML
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    <!-- app/config/config.xml -->
    <?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"
                />
            </persistence>
        </config>
    
    </container>
    
  • PHP
    1
    2
    3
    4
    5
    6
    7
    8
    9
    // app/config/config.php
    $container->loadFromExtension('cmf_core', [
        'persistence' => [
            'phpcr' => [
                'enabled'          => false,
                'manager_name'     => null,
            ],
        ],
    ]);
    
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'
            ),
        ),
    ));
    

This setting is propagated as default value to all installed CMF bundles that support this setting:

basepath

type: string default: /cms/

The basepath for CMS documents in the PHPCR tree.

This setting is propagated as default value to all installed CMF bundles that support this setting:

manager_registry

type: string default: doctrine_phpcr

The doctrine registry from which to get the document manager. This setting only needs to be changed when configuring multiple manager registries.

This setting is propagated as default value to all installed CMF bundles that support this setting:

manager_name

type: string default: null

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

This setting is propagated as default value to all installed CMF bundles that support this setting:

translation_strategy

type: string default: null

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

multilang

This configures the locales to use in multiple languages mode.

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 multi-language is enabled, the locales will be configured as default on all installed CMF bundles that use this configuration:

  • YAML
    1
    2
    3
    4
    # app/config/config.yml
    cmf_core:
        multilang:
            locales: [en, fr]
    
  • XML
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    <!-- app/config/config.xml -->
    <?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
    9
    // app/config/config.php
    $container->loadFromExtension('cmf_core', [
        'multilang' => [
            'locales' => [
                'en',
                'fr',
            ],
        ],
    ]);
    

locales

type: array default: null

List of the languages that can be used with the storage.

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
    7
    # app/config/config.yml
    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
    13
    <!-- app/config/config.xml -->
    <?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
    9
    // app/config/config.php
    $container->loadFromExtension('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,
        ],
    ]);
    

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