General

  eZ Systems Website
  Technical documentation
  Editor documentation

This Documentation contains:
 
Technical documentation:



⚠ WARNING ! This documentation is deprecated !

Please go to the current Technical Documentation

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info
titleImportant

Configuration is tightly related to the service container.
To fully understand the following content, you need to be aware of familiar with Symfony's service container and its configuration.

Basic configuration handling in eZ Publish Platform is similar to what is commonly possible with Symfony. Regarding this, you can define key/value pairs in your configuration files, under the main parameters key (like in parameters.yml).

Internally and by convention, keys follow a dot syntax where the different segments follow your configuration hierarchy. Keys are usually prefixed by a namespace corresponding to your application.
Values can be anything, including arrays and deep hashes.

Info
eZ Publish Platform core configuration is prefixed by ezsettings namespace, while internal configuration (not to be used directly) is prefixed by ezpublish namespace.

...

Dynamic configuration with the ConfigResolver

In eZ Publish, Platform it is fairly common to have different settings depending on the current siteaccess (e.g. languages, view provider configuration).

...

Available scopes are (in order of precedence) :

  1. global
  2. SiteAccess
  3. SiteAcces SiteAccess group
  4. default

It gives the opportunity to define settings for a given siteaccess, for instance, like in the legacy INI override system.

This mechanism is not limited to eZ Publish Platform internal settings (aka ezsettings namespace) and is applicable for specific needs (bundle-related, project-related, etc.).

Warning

Always prefer semantic configuration especially for internal eZ settings.
Manually editing internal eZ settings is possible, but at your own risk, as unexpected behavior can occur.

...

In order to work with the config resolver, your dynamic settings must comply internally to with the following name format: <namespace>.<scope>.parameter.name.

Info
The following configuration is an example of internal usage inside the code of eZ Publish Platform.
Code Block
themeRDark
titleNamespace + scope example
parameters:
    # Some internal configuration
    ezsettings.default.content.default_ttl: 60
    ezsettings.ezdemo_site.content.default_ttl: 3600
 
    # Here "myapp" is the namespace, followed by the siteaccess name as the parameter scope
    # Parameter "foo" will have a different value in ezdemo_site and ezdemo_site_admin
    myapp.ezdemo_site.foo: bar
    myapp.ezdemo_site_admin.foo: another value
    # Defining a default value, for other siteaccesses
    myapp.default.foo: Default value
 
    # Defining a global setting, used for all siteaccesses
    #myapp.global.some.setting: This is a global value

...

Tip

Instead of injecting the whole ConfigResolver service, you may directly inject your SiteAccess-aware settings (aka dynamic settings) into your own services.

...

Code Block
languagephp
<?php
namespace My\Cool;
 
use eZ\Publish\Core\MVC\ConfigResolverInterface;
 
class Service
{
    /**
     * @var \eZ\Publish\Core\MVC\ConfigResolverInterface
     */
    private $configResolver;
 
    public function __construct( ConfigResolverInterface $configResolver )
    {
        $this->configResolver = $configResolver;
        $myParam = $this->configResolver->getParameter( 'foo', 'myapp' );
    }
 
    // ...
}

Custom locale configuration

...

If you need to use a custom locale they can also be configurable in ezplatform.yml, adding them to the conversion map:

...