public function addSiteaccessSection(ArrayNodeDefinition $rootNode)
{
$rootNode->children()->arrayNode('siteaccess')->info('SiteAccess configuration')->children()->arrayNode('list')->info('Available SiteAccess list')->example(array('ezdemo_site', 'ezdemo_site_admin'))->isRequired()->requiresAtLeastOneElement()->prototype('scalar')->end()->end()->arrayNode('groups')->useAttributeAsKey('key')->info('SiteAccess groups. Useful to share settings between Siteaccess')->example(array('ezdemo_group' => array('ezdemo_site', 'ezdemo_site_admin')))->prototype('array')->requiresAtLeastOneElement()->prototype('scalar')->end()->end()->end()->scalarNode('default_siteaccess')->isRequired()->info('Name of the default siteaccess')->end()->arrayNode('match')->info('Siteaccess match configuration. First key is the matcher class, value is passed to the matcher. Key can be a service identifier (prepended by "@"), or a FQ class name (prepended by "\\")')->example(array('Map\\URI' => array('foo' => 'ezdemo_site', 'ezdemo_site' => 'ezdemo_site', 'ezdemo_site_admin' => 'ezdemo_site_admin'), 'Map\\Host' => array('ezpublish.dev' => 'ezdemo_site', 'admin.ezpublish.dev' => 'ezdemo_site_admin'), '\\My\\Custom\\Matcher' => array('some' => 'configuration'), '@my.custom.matcher' => array('some' => 'other_configuration')))->isRequired()->useAttributeAsKey('key')->normalizeKeys(false)->prototype('array')->useAttributeAsKey('key')->beforeNormalization()->always(function ($v) {
// Value passed to the matcher should always be an array.
// If value is not an array, we transform it to a hash, with 'value' as key.
if (!is_array($v)) {
return array('value' => $v);
}
// If passed value is a numerically indexed array, we must convert it into a hash.
// See https://jira.ez.no/browse/EZP-21876
if (array_keys($v) === range(0, count($v) - 1)) {
$final = array();
foreach ($v as $i => $val) {
$final["i{$i}"] = $val;
}
return $final;
}
return $v;
})->end()->normalizeKeys(false)->prototype('variable')->end()->end()->end()->end()->end()->arrayNode('locale_conversion')->info('Locale conversion map between eZ Publish format (i.e. fre-FR) to POSIX (i.e. fr_FR). The key is the eZ Publish locale. Check locale.yml in EzPublishCoreBundle to see natively supported locales.')->example(array('fre-FR' => 'fr_FR'))->useAttributeAsKey('key')->normalizeKeys(false)->prototype('scalar')->end()->end()->end();
}