Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

LocationView.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Parser;
8
9 use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver;
10 use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface;
11
12 class LocationView extends View
13 {
14 const NODE_KEY = 'location_view';
15 const INFO = 'Template selection settings when displaying a location. Deprecated from 5.4.5/2015.09, use content_view instead.';
16
17 public function preMap(array $config, ContextualizerInterface $contextualizer)
18 {
19 $scopes = array_merge(
20 [ConfigResolver::SCOPE_GLOBAL],
21 $config['siteaccess']['list'],
22 array_keys($config['siteaccess']['groups']),
23 [ConfigResolver::SCOPE_DEFAULT]
24 );
25
26 foreach ($scopes as $scope) {
27 if (!isset($config[$contextualizer->getSiteAccessNodeName()][$scope][static::NODE_KEY])) {
28 continue;
29 }
30
31 $locationViewConfig = &$config[$contextualizer->getSiteAccessNodeName()][$scope][static::NODE_KEY];
32 $contentViewConfig = &$config[$contextualizer->getSiteAccessNodeName()][$scope][ContentView::NODE_KEY];
33
34 // view rules without a custom controller are moved from $locationViewConfig to $contentViewConfig
35 foreach ($locationViewConfig as $viewIdentifier => $viewRules) {
36 foreach ($viewRules as $viewRuleIdentifier => $viewRule) {
37 if (!isset($viewRule['controller'])) {
38 $contentViewConfig[$viewIdentifier][$viewRuleIdentifier] =
39 $locationViewConfig[$viewIdentifier][$viewRuleIdentifier];
40 unset($locationViewConfig[$viewIdentifier][$viewRuleIdentifier]);
41 }
42 }
43 if (count($locationViewConfig[$viewIdentifier]) === 0) {
44 unset($locationViewConfig[$viewIdentifier]);
45 }
46 }
47 }
48
49 parent::preMap($config, $contextualizer);
50 $contextualizer->mapConfigArray(ContentView::NODE_KEY, $config, ContextualizerInterface::MERGE_FROM_SECOND_LEVEL);
51 }
52 }
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver
This class will help you get settings for a specific scope.
Definition: ConfigResolver.php:35
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver\SCOPE_DEFAULT
const SCOPE_DEFAULT
Definition: ConfigResolver.php:39
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver\SCOPE_GLOBAL
const SCOPE_GLOBAL
Definition: ConfigResolver.php:38
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Parser\ContentView\NODE_KEY
const NODE_KEY
Definition: Bundle/EzPublishCoreBundle/DependencyInjection/Configuration/Parser/ContentView.php:11
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Parser\LocationView
Definition: LocationView.php:13
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Parser\LocationView\NODE_KEY
const NODE_KEY
Definition: LocationView.php:14
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Parser\LocationView\preMap
preMap(array $config, ContextualizerInterface $contextualizer)
This method is called by the ConfigurationProcessor before looping over available scopes.
Definition: LocationView.php:17
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Parser\LocationView\INFO
const INFO
Definition: LocationView.php:15
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Parser\View
Definition: Bundle/EzPublishCoreBundle/DependencyInjection/Configuration/Parser/View.php:14
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface
Definition: ContextualizerInterface.php:12
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface\getSiteAccessNodeName
getSiteAccessNodeName()
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface\mapConfigArray
mapConfigArray($id, array $config, $options=0)
Maps semantic array settings to internal format, and merges them between scopes.
eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\Parser
Definition: AbstractFieldTypeParser.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.