Setups configuration for current extension.

@param ArrayNodeDefinition $builder
165764
public function getConfig(ArrayNodeDefinition $builder)
    {
        $builder->
            children()->
                scalarNode('working_dir')->
                    defaultValue('tmp/montserrat')->
                end()->
                arrayNode('prepend_paths')->
                    prototype('scalar')->
                end()->
            end()->
        end();
    }
104648
public function addBuilder(BuilderInterface $builder)
    {
        $builder->setGenerator($this);
        $builder->setTemplateDirs($this->templateDirectories);
        $builder->setMustOverwriteIfExists($this->mustOverwriteIfExists);
        $builder->setVariables(array_merge($this->variables, $builder->getVariables()));

        $this->builders[] = $builder;

        return $builder;
    }
1351024
public function buildDriverNodes(
        ArrayNodeDefinition $builder,
        $activeDriversNodeName,
        $driversNodeName,
        $defaultActiveDrivers
    ) {
        $defaultActiveDrivers = (is_array($defaultActiveDrivers)) ? $defaultActiveDrivers : [$defaultActiveDrivers];
        $builder
            ->children()
                ->variableNode($activeDriversNodeName)
                    ->defaultValue($defaultActiveDrivers)
                    ->beforeNormalization()
                        ->ifString()
                        ->then($this->getDefaultValueInitializer())
                    ->end()
                    ->validate()
                        ->ifTrue($this->getDriverKeyValidator())
                        ->thenInvalid('%s')
                    ->end()
                ->end()
                ->arrayNode($driversNodeName)
                    ->useAttributeAsKey('name')
                    ->prototype('array')
                        ->useAttributeAsKey('name')
                        ->prototype('scalar')->end()
                    ->end()
                ->end()
            ->end();
    }
1123153
public function addFieldTypeSemanticConfig(NodeBuilder $nodeBuilder)
    {
        // for BC setup deprecated configuration
        $this->setupDeprecatedConfiguration($nodeBuilder);

        $nodeBuilder
            ->arrayNode('embed')
                ->info('RichText embed tags configuration.')
                ->children()
                    ->arrayNode('content')
                        ->info('Configuration for RichText block-level Content embed tags.')
                        ->children()
                            ->append(
                                $this->getTemplateNodeDefinition(
                                    'Template used for rendering RichText block-level Content embed tags.',
                                    'MyBundle:FieldType/RichText/embed:content.html.twig'
                                )
                            )
                            ->variableNode('config')
                                ->info('Embed configuration, arbitrary configuration is allowed here.')
                            ->end()
                        ->end()
                    ->end()
                    ->arrayNode('content_denied')
                        ->info('Configuration for RichText block-level Content embed tags when embed is not permitted.')
                        ->children()
                            ->append(
                                $this->getTemplateNodeDefinition(
                                    'Template used for rendering RichText block-level Content embed tags when embed is not permitted.',
                                    'MyBundle:FieldType/RichText/embed:content_denied.html.twig'
                                )
                            )
                            ->variableNode('config')
                                ->info('Embed configuration, arbitrary configuration is allowed here.')
                            ->end()
                        ->end()
                    ->end()
                    ->arrayNode('content_inline')
                        ->info('Configuration for RichText inline-level Content embed tags.')
                        ->children()
                            ->append(
                                $this->getTemplateNodeDefinition(
                                    'Template used for rendering RichText inline-level Content embed tags.',
                                    'MyBundle:FieldType/RichText/embed:content_inline.html.twig'
                                )
                            )
                            ->variableNode('config')
                                ->info('Embed configuration, arbitrary configuration is allowed here.')
                            ->end()
                        ->end()
                    ->end()
                    ->arrayNode('content_inline_denied')
                        ->info('Configuration for RichText inline-level Content embed tags when embed is not permitted.')
                        ->children()
                            ->append(
                                $this->getTemplateNodeDefinition(
                                    'Template used for rendering RichText inline-level Content embed tags when embed is not permitted.',
                                    'MyBundle:FieldType/RichText/embed:content_inline_denied.html.twig'
                                )
                            )
                            ->variableNode('config')
                                ->info('Embed configuration, arbitrary configuration is allowed here.')
                            ->end()
                        ->end()
                    ->end()
                    ->arrayNode('location')
                        ->info('Configuration for RichText block-level Location embed tags.')
                        ->children()
                            ->append(
                                $this->getTemplateNodeDefinition(
                                    'Template used for rendering RichText block-level Location embed tags.',
                                    'MyBundle:FieldType/RichText/embed:location.html.twig'
                                )
                            )
                            ->variableNode('config')
                                ->info('Embed configuration, arbitrary configuration is allowed here.')
                            ->end()
                        ->end()
                    ->end()
                    ->arrayNode('location_denied')
                        ->info('Configuration for RichText block-level Location embed tags when embed is not permitted.')
                        ->children()
                            ->append(
                                $this->getTemplateNodeDefinition(
                                    'Template used for rendering RichText block-level Location embed tags when embed is not permitted.',
                                    'MyBundle:FieldType/RichText/embed:location_denied.html.twig'
                                )
                            )
                            ->variableNode('config')
                                ->info('Embed configuration, arbitrary configuration is allowed here.')
                            ->end()
                        ->end()
                    ->end()
                    ->arrayNode('location_inline')
                        ->info('Configuration for RichText inline-level Location embed tags.')
                        ->children()
                            ->append(
                                $this->getTemplateNodeDefinition(
                                    'Template used for rendering RichText inline-level Location embed tags.',
                                    'MyBundle:FieldType/RichText/embed:location_inline.html.twig'
                                )
                            )
                            ->variableNode('config')
                                ->info('Embed configuration, arbitrary configuration is allowed here.')
                            ->end()
                        ->end()
                    ->end()
                    ->arrayNode('location_inline_denied')
                        ->info('Configuration for RichText inline-level Location embed tags when embed is not permitted.')
                        ->children()
                            ->append(
                                $this->getTemplateNodeDefinition(
                                    'Template used for rendering RichText inline-level Location embed tags when embed is not permitted.',
                                    'MyBundle:FieldType/RichText/embed:location_inline_denied.html.twig'
                                )
                            )
                            ->variableNode('config')
                                ->info('Embed configuration, arbitrary configuration is allowed here.')
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end();

        // RichText Custom Tags configuration (list of Custom Tags enabled for current SiteAccess scope)
        $nodeBuilder
            ->arrayNode('custom_tags')
                ->info('List of RichText Custom Tags enabled for the current scope. The Custom Tags must be defined in ezpublish.ezrichtext.custom_tags Node.')
                ->scalarPrototype()->end()
            ->end();

        // RichText Custom Styles configuration (list of Custom Styles enabled for current SiteAccess scope)
        $nodeBuilder
            ->arrayNode('custom_styles')
                ->info('List of RichText Custom Styles enabled for the current scope. The Custom Styles must be defined in ezpublish.ezrichtext.custom_styles Node.')
                ->scalarPrototype()->end()
            ->end();
    }
18199
public function addFieldOptions($builder)
    {
        $builder->get('options')
            ->add('width', NumberType::class, ['required' => false])
            ->add('height', NumberType::class, ['required' => false])
        ;
    }
1365318
protected function addUndoEnd(Builder $builder): void
    {
        $builder->macro('undoEnd', function (Builder $builder) {
            $builder->withEnded();

            return $builder->update(['ended_at' => null]);
        });
    }
1000239
protected function addWithInactive(Builder $builder)
    {
        $builder->macro('withInactive', function (Builder $builder) {

            $this->remove($builder, $builder->getModel());
            return $builder;
        });
    }
1146973
function getConfig(ArrayNodeDefinition $builder)
    {
        $builder->
            children()->
                scalarNode('framework_path')->
                    defaultValue('framework')->
                end()->
                scalarNode('screenshot_path')->
                    defaultNull()->
                end()->
                arrayNode('region_map')->
                    useAttributeAsKey('key')->
                    prototype('variable')->end()->
                end()->
                scalarNode('admin_url')->
                    defaultValue('/admin/')->
                end()->
                scalarNode('login_url')->
                    defaultValue('/Security/login')->
                end()->
                scalarNode('ajax_timeout')->
                    defaultValue(5000)->
                end()->
                arrayNode('ajax_steps')->
                    defaultValue(array(
                        'go to',
                        'follow',
                        'press',
                        'click',
                        'submit'
                    ))->
                    prototype('scalar')->
                end()->
            end()->
        end();
    }
183767
protected function addWithNotAccepted(Builder $builder): void
    {
        $builder->macro('withNotAccepted', function (Builder $builder) {
            return $builder->withoutGlobalScope($this);
        });
    }
1235707
public function configure(ArrayNodeDefinition $builder)
    {
        $builder
            ->addDefaultsIfNotSet()
            ->children()
                ->arrayNode('fixtures')
                    ->beforeNormalization()
                        ->ifTrue(function($v) {
                            return is_scalar($v);
                        })
                        ->then(function($v){
                            return array(
                                'default'   => array('app'),
                                'key_paths' => array('app' => $v));
                        })
                    ->end()
                    ->validate()
                        ->ifTrue(function($v) {
                            foreach ($v['default'] as $default) {
                                if (!array_key_exists($default, $v['key_paths'])) {
                                    return true;
                                }
                            }
                        })
                        ->thenInvalid("You can't define a default which is not present in key_paths.")
                    ->end()
                    ->children()
                        ->scalarNode('default_loading')
                            ->defaultValue(AliceFixturesExecutor::DEFAULT_LOADING_IMPLICIT)
                            ->validate()
                                ->ifNotInArray(array(AliceFixturesExecutor::DEFAULT_LOADING_IMPLICIT, AliceFixturesExecutor::DEFAULT_LOADING_EXPLICIT))
                                ->thenInvalid('fixtures.default_loading should be implicit or explicit.')
                            ->end()
                        ->end()
                        ->arrayNode('default')
                            ->beforeNormalization()
                                ->ifTrue(function($v) {
                                    return is_scalar($v);
                                })
                                ->then(function($v) {
                                    return array($v);
                                })
                            ->end()
                            ->prototype('scalar')->end()
                        ->end()
                        ->arrayNode('key_paths')
                            ->useAttributeAsKey('key_path')
                            ->validate()
                                ->ifTrue(function($v) {
                                    return array_key_exists(FixtureStack::DEFAULT_KEY, $v);
                                })
                                ->thenInvalid('You cannot add a key_path with key “'.FixtureStack::DEFAULT_KEY.'“, this is a reserved word.')
                            ->end()
                            ->prototype('scalar')->end()
                        ->end()
                    ->end()
                ->end()
                ->scalarNode('lifetime')->end()
                ->arrayNode('faker')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->scalarNode('locale')->defaultValue('en_US')->end()
                        ->arrayNode('providers')
                            ->beforeNormalization()
                                ->always(function($v) {
                                    return array_map(function($class) {
                                        return new $class();
                                    }, $v);
                                })
                            ->end()
                            ->prototype('variable')->end()
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('adapters')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->arrayNode('elastica')
                            ->children()
                                ->scalarNode('fixture_class')
                                    ->defaultValue('Rezzza\AliceExtension\Fixture\ElasticaFixture')
                                    ->cannotBeEmpty()
                                ->end()
                                ->scalarNode('index_service')
                                    ->cannotBeEmpty()
                                ->end()
                                ->arrayNode('mapping')
                                    ->prototype('scalar')->end()
                                ->end()
                            ->end()
                        ->end()
                        ->arrayNode('orm')
                            ->addDefaultsIfNotSet()
                            ->children()
                                ->scalarNode('fixture_class')
                                    ->defaultValue('Rezzza\AliceExtension\Fixture\ORMFixture')
                                    ->cannotBeEmpty()
                                ->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('faker')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->scalarNode('locale')->defaultValue('en_US')->end()
                        ->arrayNode('providers')
                            ->beforeNormalization()
                                ->always(function($v) {
                                    return array_map(function($class) {
                                        return new $class();
                                    }, $v);
                                })
                            ->end()
                            ->prototype('variable')->end()
                        ->end()
                    ->end()
                ->end()
            ->end()
        ;
    }
1321331
public function addConfiguration(NodeDefinition $builder)
    {
        $builder
            ->children()
                ->scalarNode('key')->isRequired()->cannotBeEmpty()->end()
                ->scalarNode('secret_key')->isRequired()->cannotBeEmpty()->end()
                ->scalarNode('bucket_name')->isRequired()->cannotBeEmpty()->end()
            ->end()
        ;
    }
569843
protected function defineAttributes(NodeBuilder $builder)
    {
        $builder->arrayNode('attributes')
            ->useAttributeAsKey('')
            ->prototype('array')
            ->children()

            ->scalarNode('type')
                ->cannotBeEmpty()
            ->end()

            ->scalarNode('getter')
                ->cannotBeEmpty()
            ->end()

            ->scalarNode('setter')
                ->cannotBeEmpty()
            ->end()

            ->booleanNode('processNull')
                ->defaultFalse()
            ->end();
    }
1234182
protected function defineLinks(NodeBuilder $builder)
    {
        $builder->arrayNode('links')
            ->useAttributeAsKey('')
            ->prototype('array')
            ->children()

            ->scalarNode('resource')
                ->isRequired()
                ->cannotBeEmpty()
            ->end()

            ->arrayNode('parameters')
                ->prototype('scalar')->end()
            ->end()

            ->arrayNode('metadata')
                ->prototype('scalar')->end()
            ->end();
    }
1168789
protected function setupTree(ArrayNodeDefinition $rootNode)
    {
        $rootNode
            ->children()

                /**
                 * Bundle config definition.
                 */
                ->integerNode('resolver_priority')
                    ->defaultValue(-8)
                ->end()

                /**
                 * Provider request.
                 */
                ->enumNode('request')
                    ->values([
                        RequestParameterProvider::CURRENT_REQUEST,
                        RequestParameterProvider::MASTER_REQUEST,
                    ])
                    ->defaultValue(RequestParameterProvider::CURRENT_REQUEST)
                ->end()

                /**
                 * Form config definition.
                 */
                ->arrayNode('form')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('active')
                            ->defaultTrue()
                        ->end()
                        ->scalarNode('default_name')
                            ->defaultValue('form')
                        ->end()
                    ->end()
                ->end()

                /**
                 * Flush config definition.
                 */
                ->arrayNode('flush')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('active')
                            ->defaultTrue()
                        ->end()
                        ->scalarNode('default_manager')
                            ->defaultValue('default')
                        ->end()
                    ->end()
                ->end()

                /**
                 * Entity config definition.
                 */
                ->arrayNode('entity')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('active')
                            ->defaultTrue()
                        ->end()
                        ->scalarNode('default_name')
                            ->defaultValue('entity')
                        ->end()
                        ->scalarNode('default_persist')
                            ->defaultTrue()
                        ->end()
                        ->booleanNode('fallback_mapping')
                            ->defaultFalse()
                        ->end()
                         ->scalarNode('default_factory_method')
                            ->defaultValue('create')
                        ->end()
                        ->booleanNode('default_factory_static')
                            ->defaultValue(true)
                        ->end()
                    ->end()
                ->end()

                /**
                 * Bundle config definition.
                 */
                ->arrayNode('json_response')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('active')
                            ->defaultTrue()
                        ->end()
                        ->integerNode('default_status')
                            ->defaultValue(200)
                        ->end()
                        ->integerNode('default_error_status')
                            ->defaultValue(500)
                        ->end()
                        ->arrayNode('default_headers')
                            ->useAttributeAsKey('name')
                            ->prototype('scalar')
                            ->end()
                            ->defaultValue([])
                        ->end()
                    ->end()
                ->end()

                /**
                 * Log config definition.
                 */
                ->arrayNode('log')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('active')
                            ->defaultTrue()
                        ->end()
                        ->enumNode('default_level')
                            ->values([
                                AnnotationLog::LVL_EMERG,
                                AnnotationLog::LVL_ALERT,
                                AnnotationLog::LVL_CRIT,
                                AnnotationLog::LVL_ERR,
                                AnnotationLog::LVL_WARNING,
                                AnnotationLog::LVL_INFO,
                                AnnotationLog::LVL_DEBUG,
                                AnnotationLog::LVL_LOG,
                            ])
                            ->defaultValue(AnnotationLog::LVL_INFO)
                        ->end()
                        ->enumNode('default_execute')
                            ->values([
                                AnnotationLog::EXEC_PRE,
                                AnnotationLog::EXEC_POST,
                                AnnotationLog::EXEC_BOTH,
                            ])
                            ->defaultValue(AnnotationLog::EXEC_PRE)
                        ->end()
                    ->end()
                ->end()

                ->arrayNode('paginator')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('active')
                            ->defaultTrue()
                        ->end()
                        ->scalarNode('default_name')
                            ->defaultValue('paginator')
                        ->end()
                        ->integerNode('default_page')
                            ->defaultValue(1)
                        ->end()
                        ->integerNode('default_limit_per_page')
                            ->defaultValue(10)
                        ->end()
                    ->end()
                ->end()

                /**
                 * Get config definition.
                 */
                ->arrayNode('get')
                    ->addDefaultsIfNotSet()
                        ->children()
                            ->booleanNode('active')
                                ->defaultTrue()
                        ->end()
                    ->end()
                ->end()

                /**
                 * Post config definition.
                 */
                ->arrayNode('post')
                    ->addDefaultsIfNotSet()
                        ->children()
                            ->booleanNode('active')
                                ->defaultTrue()
                            ->end()
                        ->end()
                    ->end()
                ->end()

            ->end();
    }
874486
protected function addWithBanned(Builder $builder): void
    {
        $builder->macro('withBanned', function (Builder $builder) {
            return $builder->withoutGlobalScope($this);
        });
    }
726038
public static function create( ConfigurationBuilder $builder  )
	{
		// TODO Currently only supports PHP files, need to add optional json and yaml support.

		$configPath = Framework::fw()->buildPath( '__config' );
		$configFile = $configPath . __ . $builder->key() . ".php";

		if ( file_put_contents( $configFile, $builder->toPhp( true ) ) === false || !is_array( $data = include( $configFile ) ) )
		{
			@unlink( $configFile );

			throw new FrameworkException( "Configuration error, either failed to write config file to [" . $configFile . "] or returned data is not an array." );
		}

		Framework::config()->set( $builder->key(), $data );
	}
71843
protected function setupTree(ArrayNodeDefinition $rootNode)
    {
        $rootNode
            ->addDefaultsIfNotSet()
            ->children()
                ->arrayNode('queues')
                    ->prototype('scalar')->end()
                ->end()
                ->scalarNode('serializer')
                    ->treatNullLike('RSQueue\\Serializer\\JsonSerializer')
                    ->defaultValue('RSQueue\\Serializer\\JsonSerializer')
                ->end()
                ->arrayNode('collector')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->booleanNode('enable')
                            ->defaultTrue()
                        ->end()
                    ->end()
                ->end()
                ->arrayNode('server')
                    ->addDefaultsIfNotSet()
                    ->children()
                        ->arrayNode('redis')
                            ->addDefaultsIfNotSet()
                            ->children()
                                ->scalarNode('cluster')
                                    ->defaultFalse()
                                ->end()
                                ->scalarNode('host')
                                    ->defaultValue('127.0.0.1')
                                ->end()
                                ->scalarNode('port')
                                    ->defaultValue(6379)
                                ->end()
                                ->scalarNode('database')
                                    ->defaultNull()
                                ->end()
                            ->end()
                        ->end()
                    ->end()
                ->end()
            ->end();
    }