PHP 인터페이스 eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface

파일 보기 프로젝트 열기: ezsystems/ezpublish-kernel 0 사용 예제들

공개 메소드들

메소드 설명
getAvailableSiteAccesses ( ) : array
getContainer ( ) : Symfony\Component\DependencyInjection\ContainerInterface
getGroupsBySiteAccess ( ) : array
getNamespace ( ) : string
getSiteAccessNodeName ( ) : string
mapConfigArray ( string $id, array $config, integer $options ) Maps semantic array settings to internal format, and merges them between scopes.
mapSetting ( string $id, array $config ) : mixed Maps a semantic setting to internal format for all declared scopes.
setAvailableSiteAccesses ( array $availableSiteAccesses ) Injects registered SiteAccesses (i.e. configuration scopes).
setContainer ( Symfony\Component\DependencyInjection\ContainerInterface $container )
setContextualParameter ( string $parameterName, string $scope, mixed $value ) Defines a contextual parameter in the container for given scope in current namespace.
setGroupsBySiteAccess ( array $groupsBySiteAccess ) Injects names of registered SiteAccess groups, indexed by SiteAccess.
setNamespace ( string $namespace ) Injects namespace for internal settings.
setSiteAccessNodeName ( string $scopeNodeName ) Injects the name of the node under which scope based (semantic) configuration takes place.

메소드 상세

getAvailableSiteAccesses() 공개 메소드

public getAvailableSiteAccesses ( ) : array
리턴 array

getContainer() 공개 메소드

public getContainer ( ) : Symfony\Component\DependencyInjection\ContainerInterface
리턴 Symfony\Component\DependencyInjection\ContainerInterface

getGroupsBySiteAccess() 공개 메소드

public getGroupsBySiteAccess ( ) : array
리턴 array

getNamespace() 공개 메소드

public getNamespace ( ) : string
리턴 string

getSiteAccessNodeName() 공개 메소드

public getSiteAccessNodeName ( ) : string
리턴 string

mapConfigArray() 공개 메소드

This is useful when you have e.g. a hash of settings defined in a siteaccess group and you want an entry of this hash, defined at the siteaccess or global level, to replace the one in the group. Defined arrays are merged in the following scopes: * default * siteaccess groups * siteaccess * global To calculate the precedence of siteaccess groups, they are alphabetically sorted. Example: yaml acme_demo: system: my_siteaccess_group: foo_setting: foo: "bar" some: "thing" an_integer: 123 enabled: false # Assuming my_siteaccess is part of my_siteaccess_group my_siteaccess: foo_setting: an_integer: 456 enabled: true In your DIC extension php namespace Acme\DemoBundle\DependencyInjection; use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader; use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware; class AcmeDemoExtension extends Extension { public function load( array $configs, ContainerBuilder $container ) { $loader = new Loader\YamlFileLoader( $container, new FileLocator( __DIR__ . '/../Resources/config' ) ); $configuration = $this->getConfiguration( $configs, $container ); $config = $this->processConfiguration( $configuration, $configs ); ... $processor = new SiteAccessAware\ConfigurationProcessor( $container, 'acme_demo' ); $contextualizer = $processor->getContextualizer(); $contextualizer->mapConfigArray( 'foo_setting', $configs ); $processor->mapConfig( $config, function ( array $scopeSettings, $currentScope, SiteAccessAware\ContextualizerInterface $contextualizer ) { ... } ); } } This will result with having following parameters in the container: yaml acme_demo.my_siteaccess.foo_setting: foo: "bar" some: "thing" an_integer: 456 enabled: true acme_demo.my_siteaccess_gorup.foo_setting foo: "bar" some: "thing" an_integer: 123 enabled: false
public mapConfigArray ( string $id, array $config, integer $options )
$id string Id of the setting array to map. Note that it will be used to identify the semantic setting in $config and to define the internal setting in the container (..<$id>)
$config array Full semantic configuration array for current bundle.
$options integer Bit mask of options (see constants of the interface)

mapSetting() 공개 메소드

Resulting parameter will have format .. .
public mapSetting ( string $id, array $config ) : mixed
$id string Id of the setting to map. Note that it will be used to identify the semantic setting in $config and to define the internal setting in the container (..<$id>)
$config array Full semantic configuration array for current bundle.
리턴 mixed

setAvailableSiteAccesses() 공개 메소드

Injects registered SiteAccesses (i.e. configuration scopes).
public setAvailableSiteAccesses ( array $availableSiteAccesses )
$availableSiteAccesses array

setContainer() 공개 메소드

public setContainer ( Symfony\Component\DependencyInjection\ContainerInterface $container )
$container Symfony\Component\DependencyInjection\ContainerInterface

setContextualParameter() 공개 메소드

Resulting parameter will have format .. . php getConfiguration( $configs, $container ); $config = $this->processConfiguration( $configuration, $configs ); ... $processor = new SiteAccessAware\ConfigurationProcessor( $container, 'acme_demo' ); $processor->mapConfig( $config, function ( array $scopeSettings, $currentScope, SiteAccessAware\ContextualizerInterface $contextualizer ) { Value of 'some_semantic_parameter' will be stored as a container parameter under key acme_demo.<$currentScope>.my_internal_parameter $contextualizer->setContextualParameter( 'my_internal_parameter', $currentScope, $scopeSettings['some_semantic_parameter'] ); } ); } }
public setContextualParameter ( string $parameterName, string $scope, mixed $value )
$parameterName string
$scope string
$value mixed

setGroupsBySiteAccess() 공개 메소드

i.e. Which groups a SiteAccess is part of.
public setGroupsBySiteAccess ( array $groupsBySiteAccess )
$groupsBySiteAccess array

setNamespace() 공개 메소드

Registered internal settings always have the format .. e.g. ezsettings.default.session.
public setNamespace ( string $namespace )
$namespace string

setSiteAccessNodeName() 공개 메소드

Injects the name of the node under which scope based (semantic) configuration takes place.
public setSiteAccessNodeName ( string $scopeNodeName )
$scopeNodeName string