setContextualParameter() public method

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
Beispiel #1
0
 /**
  * Post process configuration to add io_root_dir and io_prefix.
  */
 public function postMap(array $config, ContextualizerInterface $contextualizer)
 {
     $container = $contextualizer->getContainer();
     // complex parameters dependencies
     foreach (array_merge($config['siteaccess']['list'], array_keys($config['siteaccess']['groups'])) as $scope) {
         $this->addComplexParametersDependencies('io.url_prefix', $scope, $container);
         $this->addComplexParametersDependencies('io.legacy_url_prefix', $scope, $container);
         $this->addComplexParametersDependencies('io.root_dir', $scope, $container);
     }
     // we should only write for default, and for sa/sa groups/global IF they have a declared value
     $scopes = array_merge(array('default'), $config['siteaccess']['list'], array_keys($config['siteaccess']['groups']));
     foreach ($scopes as $scope) {
         // post process io.url_prefix for complex settings
         $postProcessedValue = $this->postProcessComplexSetting('io.url_prefix', $scope, $container);
         if (is_string($postProcessedValue)) {
             $contextualizer->setContextualParameter('io.url_prefix', $scope, $postProcessedValue);
         }
         // post process io.legacy_url_prefix for complex settings
         $postProcessedValue = $this->postProcessComplexSetting('io.legacy_url_prefix', $scope, $container);
         if (is_string($postProcessedValue)) {
             $contextualizer->setContextualParameter('io.legacy_url_prefix', $scope, $postProcessedValue);
         }
         // post process io.root_dir for complex settings
         $postProcessedValue = $this->postProcessComplexSetting('io.root_dir', $scope, $container);
         if (is_string($postProcessedValue)) {
             $contextualizer->setContextualParameter('io.root_dir', $scope, $postProcessedValue);
         }
     }
 }
 protected function mapConfigYui(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
 {
     if (isset($scopeSettings['yui']['filter'])) {
         $contextualizer->setContextualParameter('yui.filter', $currentScope, $scopeSettings['yui']['filter']);
     }
     if (isset($scopeSettings['yui']['combine'])) {
         $contextualizer->setContextualParameter('yui.combine', $currentScope, $scopeSettings['yui']['combine']);
     }
     if (isset($scopeSettings['yui']['modules'])) {
         // Adding entries in $scopeSettings, so that they can be merged across scopes further on,
         // as $contextualizer->mapConfigArray() can only merge with 1st level settings in the configuration tree.
         foreach ($scopeSettings['yui']['modules'] as $moduleName => $moduleConfig) {
             $scopeSettings['yui.modules'][] = $moduleName;
             $this->allModules[] = $moduleName;
             if (isset($moduleConfig['path'])) {
                 $contextualizer->setContextualParameter("yui.modules.{$moduleName}.path", $currentScope, $moduleConfig['path']);
             }
             $contextualizer->setContextualParameter("yui.modules.{$moduleName}.type", $currentScope, $moduleConfig['type']);
             if (isset($moduleConfig['requires'])) {
                 if (!isset($scopeSettings["yui.modules.{$moduleName}.requires"])) {
                     $scopeSettings["yui.modules.{$moduleName}.requires"] = [];
                 }
                 $scopeSettings["yui.modules.{$moduleName}.requires"] = array_merge($scopeSettings["yui.modules.{$moduleName}.requires"], $moduleConfig['requires']);
             }
             if (isset($moduleConfig['dependencyOf'])) {
                 if (!isset($scopeSettings["yui.modules.{$moduleName}.dependencyOf"])) {
                     $scopeSettings["yui.modules.{$moduleName}.dependencyOf"] = [];
                 }
                 $scopeSettings["yui.modules.{$moduleName}.dependencyOf"] = array_merge($scopeSettings["yui.modules.{$moduleName}.dependencyOf"], $moduleConfig['dependencyOf']);
             }
         }
     }
 }
 public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
 {
     if (!empty($scopeSettings['content'])) {
         $contextualizer->setContextualParameter('content.view_cache', $currentScope, $scopeSettings['content']['view_cache']);
         $contextualizer->setContextualParameter('content.ttl_cache', $currentScope, $scopeSettings['content']['ttl_cache']);
         $contextualizer->setContextualParameter('content.default_ttl', $currentScope, $scopeSettings['content']['default_ttl']);
         if (isset($scopeSettings['content']['tree_root'])) {
             $contextualizer->setContextualParameter('content.tree_root.location_id', $currentScope, $scopeSettings['content']['tree_root']['location_id']);
             if (isset($scopeSettings['content']['tree_root']['excluded_uri_prefixes'])) {
                 $contextualizer->setContextualParameter('content.tree_root.excluded_uri_prefixes', $currentScope, $scopeSettings['content']['tree_root']['excluded_uri_prefixes']);
             }
         }
     }
     if (!empty($scopeSettings['fieldtypes'])) {
         // Workaround to be able to use registerInternalConfigArray() which only supports first level entries.
         if (isset($scopeSettings['fieldtypes']['ezxml']['custom_tags'])) {
             $scopeSettings['fieldtypes.ezxml.custom_xsl'] = $scopeSettings['fieldtypes']['ezxml']['custom_tags'];
             unset($scopeSettings['fieldtypes']['ezxml']['custom_tags']);
         }
         if (isset($scopeSettings['fieldtypes']['ezrichtext']['output_custom_tags'])) {
             $scopeSettings['fieldtypes.ezrichtext.output_custom_xsl'] = $scopeSettings['fieldtypes']['ezrichtext']['output_custom_tags'];
             unset($scopeSettings['fieldtypes']['ezrichtext']['output_custom_tags']);
         }
         if (isset($scopeSettings['fieldtypes']['ezrichtext']['edit_custom_tags'])) {
             $scopeSettings['fieldtypes.ezrichtext.edit_custom_xsl'] = $scopeSettings['fieldtypes']['ezrichtext']['edit_custom_tags'];
             unset($scopeSettings['fieldtypes']['ezrichtext']['edit_custom_tags']);
         }
         if (isset($scopeSettings['fieldtypes']['ezrichtext']['input_custom_tags'])) {
             $scopeSettings['fieldtypes.ezrichtext.input_custom_xsl'] = $scopeSettings['fieldtypes']['ezrichtext']['input_custom_tags'];
             unset($scopeSettings['fieldtypes']['ezrichtext']['input_custom_tags']);
         }
     }
 }
 public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
 {
     if (!empty($scopeSettings['fieldtypes'])) {
         // Workaround to be able to use Contextualizer::mapConfigArray() which only supports first level entries.
         if (isset($scopeSettings['fieldtypes']['ezrichtext']['output_custom_tags'])) {
             $scopeSettings['fieldtypes.ezrichtext.output_custom_xsl'] = $scopeSettings['fieldtypes']['ezrichtext']['output_custom_tags'];
             unset($scopeSettings['fieldtypes']['ezrichtext']['output_custom_tags']);
         }
         if (isset($scopeSettings['fieldtypes']['ezrichtext']['edit_custom_tags'])) {
             $scopeSettings['fieldtypes.ezrichtext.edit_custom_xsl'] = $scopeSettings['fieldtypes']['ezrichtext']['edit_custom_tags'];
             unset($scopeSettings['fieldtypes']['ezrichtext']['edit_custom_tags']);
         }
         if (isset($scopeSettings['fieldtypes']['ezrichtext']['input_custom_tags'])) {
             $scopeSettings['fieldtypes.ezrichtext.input_custom_xsl'] = $scopeSettings['fieldtypes']['ezrichtext']['input_custom_tags'];
             unset($scopeSettings['fieldtypes']['ezrichtext']['input_custom_tags']);
         }
         if (isset($scopeSettings['fieldtypes']['ezrichtext']['tags'])) {
             foreach ($scopeSettings['fieldtypes']['ezrichtext']['tags'] as $name => $tagSettings) {
                 $contextualizer->setContextualParameter("fieldtypes.ezrichtext.tags.{$name}", $currentScope, $scopeSettings['fieldtypes']['ezrichtext']['tags'][$name]);
             }
         }
         if (isset($scopeSettings['fieldtypes']['ezrichtext']['embed'])) {
             foreach ($scopeSettings['fieldtypes']['ezrichtext']['embed'] as $type => $embedSettings) {
                 $contextualizer->setContextualParameter("fieldtypes.ezrichtext.embed.{$type}", $currentScope, $scopeSettings['fieldtypes']['ezrichtext']['embed'][$type]);
             }
         }
     }
 }
 public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
 {
     if (isset($scopeSettings['imagemagick']['pre_parameters'])) {
         $contextualizer->setContextualParameter('imagemagick.pre_parameters', $currentScope, $scopeSettings['imagemagick']['pre_parameters']);
     }
     if (isset($scopeSettings['imagemagick']['post_parameters'])) {
         $contextualizer->setContextualParameter('imagemagick.post_parameters', $currentScope, $scopeSettings['imagemagick']['post_parameters']);
     }
 }
Beispiel #6
0
    public function mapConfig( array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer )
    {
        // Common settings
        if ( isset( $scopeSettings['default_provider'] ) )
            $contextualizer->setContextualParameter( 'default_provider', $currentScope, $scopeSettings['default_provider'] );
        if ( isset( $scopeSettings['content_comments'] ) )
        {
            $scopeSettings['content_comments'] = array( 'comments' => $scopeSettings['content_comments'] );
        }

        // Disqus
        if ( isset( $scopeSettings['disqus']['shortname'] ) )
            $contextualizer->setContextualParameter( 'disqus.shortname', $currentScope, $scopeSettings['disqus']['shortname'] );
        if ( isset( $scopeSettings['disqus']['template'] ) )
            $contextualizer->setContextualParameter( 'disqus.default_template', $currentScope, $scopeSettings['disqus']['template'] );

        // Facebook
        if ( isset( $scopeSettings['facebook']['app_id'] ) )
            $contextualizer->setContextualParameter( 'facebook.app_id', $currentScope, $scopeSettings['facebook']['app_id'] );
        if ( isset( $scopeSettings['facebook']['width'] ) )
            $contextualizer->setContextualParameter( 'facebook.width', $currentScope, $scopeSettings['facebook']['width'] );
        if ( isset( $scopeSettings['facebook']['num_posts'] ) )
            $contextualizer->setContextualParameter( 'facebook.num_posts', $currentScope, $scopeSettings['facebook']['num_posts'] );
        if ( isset( $scopeSettings['facebook']['color_scheme'] ) )
            $contextualizer->setContextualParameter( 'facebook.color_scheme', $currentScope, $scopeSettings['facebook']['color_scheme'] );
        if ( isset( $scopeSettings['facebook']['include_sdk'] ) )
            $contextualizer->setContextualParameter( 'facebook.include_sdk', $currentScope, $scopeSettings['facebook']['include_sdk'] );
        if ( isset( $scopeSettings['facebook']['template'] ) )
            $contextualizer->setContextualParameter( 'facebook.default_template', $currentScope, $scopeSettings['facebook']['template'] );
    }
Beispiel #7
0
 public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
 {
     if (!empty($scopeSettings['content'])) {
         $contextualizer->setContextualParameter('content.view_cache', $currentScope, $scopeSettings['content']['view_cache']);
         $contextualizer->setContextualParameter('content.ttl_cache', $currentScope, $scopeSettings['content']['ttl_cache']);
         $contextualizer->setContextualParameter('content.default_ttl', $currentScope, $scopeSettings['content']['default_ttl']);
         if (isset($scopeSettings['content']['tree_root'])) {
             $contextualizer->setContextualParameter('content.tree_root.location_id', $currentScope, $scopeSettings['content']['tree_root']['location_id']);
             if (isset($scopeSettings['content']['tree_root']['excluded_uri_prefixes'])) {
                 $contextualizer->setContextualParameter('content.tree_root.excluded_uri_prefixes', $currentScope, $scopeSettings['content']['tree_root']['excluded_uri_prefixes']);
             }
         }
     }
 }
 public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
 {
     if (empty($scopeSettings['user_registration'])) {
         return;
     }
     $settings = $scopeSettings['user_registration'];
     if (!empty($settings['group_id'])) {
         $contextualizer->setContextualParameter('user_registration.group_id', $currentScope, $settings['group_id']);
     }
     if (!empty($settings['templates']['form'])) {
         $contextualizer->setContextualParameter('user_registration.templates.form', $currentScope, $settings['templates']['form']);
     }
     if (!empty($settings['templates']['confirmation'])) {
         $contextualizer->setContextualParameter('user_registration.templates.confirmation', $currentScope, $settings['templates']['confirmation']);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
 {
     // Common settings
     if (isset($scopeSettings['server_uri'])) {
         $contextualizer->setContextualParameter('server_uri', $currentScope, $scopeSettings['server_uri']);
     }
     if (isset($scopeSettings['yoochoose']['customer_id'])) {
         $contextualizer->setContextualParameter('yoochoose.customer_id', $currentScope, $scopeSettings['yoochoose']['customer_id']);
     }
     if (isset($scopeSettings['yoochoose']['license_key'])) {
         $contextualizer->setContextualParameter('yoochoose.license_key', $currentScope, $scopeSettings['yoochoose']['license_key']);
     }
     if (isset($scopeSettings['recommender']['included_content_types'])) {
         $contextualizer->setContextualParameter('recommender.included_content_types', $currentScope, $scopeSettings['recommender']['included_content_types']);
     }
 }
Beispiel #10
0
 public function preMap(array $config, ContextualizerInterface $contextualizer)
 {
     foreach ($config['siteaccess']['groups'] as $group => $saArray) {
         if (isset($config['system'][$group][static::NODE_KEY])) {
             $contextualizer->setContextualParameter(static::NODE_KEY, $group, $config[$contextualizer->getSiteAccessNodeName()][$group][static::NODE_KEY]);
         }
     }
     $contextualizer->mapConfigArray(static::NODE_KEY, $config);
 }
 /**
  * {@inheritdoc}
  */
 public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
 {
     // common settings
     if (isset($scopeSettings['providers'])) {
         $contextualizer->setContextualParameter('providers', $currentScope, $scopeSettings['providers']);
     }
     if (isset($scopeSettings['template'])) {
         $contextualizer->setContextualParameter('template', $currentScope, $scopeSettings['template']);
     }
     // Facebook like settings
     if (isset($scopeSettings['facebook_like.layout'])) {
         $contextualizer->setContextualParameter('facebook_like.layout', $currentScope, $scopeSettings['facebook_like.layout']);
     }
     if (isset($scopeSettings['facebook_like.width'])) {
         $contextualizer->setContextualParameter('facebook_like.width', $currentScope, $scopeSettings['facebook_like.width']);
     }
     if (isset($scopeSettings['facebook_like.show_faces'])) {
         $contextualizer->setContextualParameter('facebook_like.show_faces', $currentScope, $scopeSettings['facebook_like.show_faces']);
     }
     if (isset($scopeSettings['facebook_like.share'])) {
         $contextualizer->setContextualParameter('facebook_like.share', $currentScope, $scopeSettings['facebook_like.share']);
     }
     // Facebook recommend settings
     if (isset($scopeSettings['facebook_recommend.layout'])) {
         $contextualizer->setContextualParameter('facebook_recommend.layout', $currentScope, $scopeSettings['facebook_recommend.layout']);
     }
     if (isset($scopeSettings['facebook_recommend.width'])) {
         $contextualizer->setContextualParameter('facebook_recommend.width', $currentScope, $scopeSettings['facebook_recommend.width']);
     }
     if (isset($scopeSettings['facebook_recommend.show_faces'])) {
         $contextualizer->setContextualParameter('facebook_recommend.show_faces', $currentScope, $scopeSettings['facebook_recommend.show_faces']);
     }
     if (isset($scopeSettings['facebook_recommend.share'])) {
         $contextualizer->setContextualParameter('facebook_recommend.share', $currentScope, $scopeSettings['facebook_recommend.share']);
     }
     // Twitter settings
     if (isset($scopeSettings['twitter.show_username'])) {
         $contextualizer->setContextualParameter('twitter.show_username', $currentScope, $scopeSettings['twitter.show_username']);
     }
     if (isset($scopeSettings['twitter.large_button'])) {
         $contextualizer->setContextualParameter('twitter.large_button', $currentScope, $scopeSettings['twitter.large_button']);
     }
     if (isset($scopeSettings['twitter.language'])) {
         $contextualizer->setContextualParameter('twitter.language', $currentScope, $scopeSettings['twitter.language']);
     }
     // LinkedIn settings
     if (isset($scopeSettings['linkedin.count_mode'])) {
         $contextualizer->setContextualParameter('linkedin.count_mode', $currentScope, $scopeSettings['linkedin.count_mode']);
     }
     if (isset($scopeSettings['linkedin.language'])) {
         $contextualizer->setContextualParameter('linkedin.language', $currentScope, $scopeSettings['linkedin.language']);
     }
     // Google Plus settings
     if (isset($scopeSettings['google_plus.size'])) {
         $contextualizer->setContextualParameter('google_plus.size', $currentScope, $scopeSettings['google_plus.size']);
     }
     if (isset($scopeSettings['google_plus.annotation'])) {
         $contextualizer->setContextualParameter('google_plus.annotation', $currentScope, $scopeSettings['google_plus.annotation']);
     }
     if (isset($scopeSettings['google_plus.width'])) {
         $contextualizer->setContextualParameter('google_plus.width', $currentScope, $scopeSettings['google_plus.width']);
     }
     if (isset($scopeSettings['google_plus.language'])) {
         $contextualizer->setContextualParameter('google_plus.language', $currentScope, $scopeSettings['google_plus.language']);
     }
 }
Beispiel #12
0
 public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer)
 {
     if (isset($scopeSettings['database'])) {
         $this->addDatabaseConfigSuggestion($currentScope, $scopeSettings['database']);
     }
     if (isset($scopeSettings['repository'])) {
         $contextualizer->setContextualParameter('repository', $currentScope, $scopeSettings['repository']);
     }
     if (isset($scopeSettings['legacy_mode'])) {
         $contextualizer->setContextualParameter('legacy_mode', $currentScope, $scopeSettings['legacy_mode']);
         $contextualizer->setContextualParameter('url_alias_router', $currentScope, !$scopeSettings['legacy_mode']);
     }
     if (isset($scopeSettings['cache_pool_name'])) {
         $contextualizer->setContextualParameter('cache_pool_name', $currentScope, $scopeSettings['cache_pool_name']);
     }
     if (isset($scopeSettings['var_dir'])) {
         $contextualizer->setContextualParameter('var_dir', $currentScope, $scopeSettings['var_dir']);
     }
     if (isset($scopeSettings['storage_dir'])) {
         $contextualizer->setContextualParameter('storage_dir', $currentScope, $scopeSettings['storage_dir']);
     }
     if (isset($scopeSettings['binary_dir'])) {
         $contextualizer->setContextualParameter('binary_dir', $currentScope, $scopeSettings['binary_dir']);
     }
     // session_name setting is deprecated in favor of session.name
     $container = $contextualizer->getContainer();
     $sessionOptions = $container->hasParameter("ezsettings.{$currentScope}.session") ? $container->getParameter("ezsettings.{$currentScope}.session") : array();
     if (isset($sessionOptions['name'])) {
         $contextualizer->setContextualParameter('session_name', $currentScope, $sessionOptions['name']);
     }
     // @deprecated session_name is deprecated, but if present, in addition to session.name, consider it instead (BC).
     if (isset($scopeSettings['session_name'])) {
         $sessionOptions['name'] = $scopeSettings['session_name'];
         $contextualizer->setContextualParameter('session_name', $currentScope, $scopeSettings['session_name']);
         $contextualizer->setContextualParameter('session', $currentScope, $sessionOptions);
     }
     if (isset($scopeSettings['http_cache']['purge_servers'])) {
         $contextualizer->setContextualParameter('http_cache.purge_servers', $currentScope, $scopeSettings['http_cache']['purge_servers']);
     }
     if (isset($scopeSettings['anonymous_user_id'])) {
         $contextualizer->setContextualParameter('anonymous_user_id', $currentScope, $scopeSettings['anonymous_user_id']);
     }
     if (isset($scopeSettings['user']['layout'])) {
         $contextualizer->setContextualParameter('security.base_layout', $currentScope, $scopeSettings['user']['layout']);
     }
     if (isset($scopeSettings['user']['login_template'])) {
         $contextualizer->setContextualParameter('security.login_template', $currentScope, $scopeSettings['user']['login_template']);
     }
     if (isset($scopeSettings['index_page'])) {
         $contextualizer->setContextualParameter('index_page', $currentScope, $scopeSettings['index_page']);
     }
     if (isset($scopeSettings['default_page'])) {
         $contextualizer->setContextualParameter('default_page', $currentScope, '/' . ltrim($scopeSettings['default_page'], '/'));
     }
 }