vendor/pimcore/pimcore/bundles/CoreBundle/DependencyInjection/Configuration.php line 52

Open in your IDE?
  1. <?php
  2. /**
  3.  * Pimcore
  4.  *
  5.  * This source file is available under two different licenses:
  6.  * - GNU General Public License version 3 (GPLv3)
  7.  * - Pimcore Enterprise License (PEL)
  8.  * Full copyright and license information is available in
  9.  * LICENSE.md which is distributed with this source code.
  10.  *
  11.  * @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  12.  * @license    http://www.pimcore.org/license     GPLv3 and PEL
  13.  */
  14. namespace Pimcore\Bundle\CoreBundle\DependencyInjection;
  15. use Pimcore\Bundle\CoreBundle\DependencyInjection\Config\Processor\PlaceholderProcessor;
  16. use Pimcore\Cache\Pool\Redis;
  17. use Pimcore\Storage\Redis\ConnectionFactory;
  18. use Pimcore\Targeting\Storage\CookieStorage;
  19. use Pimcore\Targeting\Storage\TargetingStorageInterface;
  20. use Pimcore\Workflow\EventSubscriber\ChangePublishedStateSubscriber;
  21. use Pimcore\Workflow\EventSubscriber\NotificationSubscriber;
  22. use Pimcore\Workflow\Notification\NotificationEmailService;
  23. use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
  24. use Symfony\Component\Config\Definition\Builder\NodeDefinition;
  25. use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  26. use Symfony\Component\Config\Definition\ConfigurationInterface;
  27. class Configuration implements ConfigurationInterface
  28. {
  29.     /**
  30.      * @var PlaceholderProcessor
  31.      */
  32.     private $placeholderProcessor;
  33.     private $placeholders = [];
  34.     public function __construct()
  35.     {
  36.         $this->placeholderProcessor = new PlaceholderProcessor();
  37.         $this->placeholders = [];
  38.     }
  39.     /**
  40.      * Generates the configuration tree builder.
  41.      *
  42.      * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder
  43.      */
  44.     public function getConfigTreeBuilder()
  45.     {
  46.         $treeBuilder = new TreeBuilder();
  47.         $rootNode $treeBuilder->root('pimcore');
  48.         $rootNode->addDefaultsIfNotSet();
  49.         $rootNode->ignoreExtraKeys();
  50.         $rootNode
  51.             ->children()
  52.                 ->arrayNode('error_handling')
  53.                     ->addDefaultsIfNotSet()
  54.                     ->children()
  55.                         ->booleanNode('render_error_document')
  56.                             ->info('Render error document in case of an error instead of showing Symfony\'s error page')
  57.                             ->defaultTrue()
  58.                             ->beforeNormalization()
  59.                                 ->ifString()
  60.                                 ->then(function ($v) {
  61.                                     return (bool)$v;
  62.                                 })
  63.                             ->end()
  64.                         ->end()
  65.                     ->end()
  66.                 ->end()
  67.                 ->arrayNode('bundles')
  68.                     ->addDefaultsIfNotSet()
  69.                     ->children()
  70.                         ->arrayNode('search_paths')
  71.                             ->prototype('scalar')->end()
  72.                         ->end()
  73.                         ->booleanNode('handle_composer')
  74.                             ->defaultTrue()
  75.                         ->end()
  76.                     ->end()
  77.                 ->end()
  78.                 ->arrayNode('flags')
  79.                     ->info('Generic map for feature flags')
  80.                     ->prototype('scalar')->end()
  81.                 ->end()
  82.                 ->arrayNode('translations')
  83.                     ->addDefaultsIfNotSet()
  84.                     ->children()
  85.                         ->booleanNode('case_insensitive')
  86.                             ->beforeNormalization()
  87.                                 ->ifString()
  88.                                 ->then(function ($v) {
  89.                                     return (bool)$v;
  90.                                 })
  91.                             ->end()
  92.                             ->info('Force Pimcore translations to NOT be case sensitive. This only applies to translations set via Pimcore\'s translator (e.g. website translations)')
  93.                             ->defaultFalse()
  94.                         ->end()
  95.                         ->arrayNode('admin_translation_mapping')
  96.                             ->useAttributeAsKey('locale')
  97.                             ->prototype('scalar')->end()
  98.                         ->end()
  99.                         ->arrayNode('debugging')
  100.                             ->info('If debugging is enabled, the translator will return the plain translation key instead of the translated message.')
  101.                             ->addDefaultsIfNotSet()
  102.                             ->canBeDisabled()
  103.                             ->children()
  104.                                 ->scalarNode('parameter')
  105.                                     ->defaultValue('pimcore_debug_translations')
  106.                                 ->end()
  107.                             ->end()
  108.                         ->end()
  109.                         ->arrayNode('data_object')
  110.                             ->addDefaultsIfNotSet()
  111.                             ->children()
  112.                                 ->arrayNode('translation_extractor')
  113.                                     ->children()
  114.                                         ->arrayNode('attributes')
  115.                                             ->info('Can be used to restrict the extracted localized fields (e.g. used by XLIFF exporter in the Pimcore backend)')
  116.                                             ->prototype('array')
  117.                                                 ->prototype('scalar')->end()
  118.                                             ->end()
  119.                                             ->example(
  120.                                                 [
  121.                                                     'Product' => ['name''description'],
  122.                                                     'Brand' => ['name'],
  123.                                                 ]
  124.                                             )
  125.                                         ->end()
  126.                                     ->end()
  127.                                 ->end()
  128.                             ->end()
  129.                         ->end()
  130.                     ->end()
  131.                 ->end()
  132.                 ->arrayNode('maps')
  133.                     ->addDefaultsIfNotSet()
  134.                     ->children()
  135.                         ->scalarNode('tile_layer_url_template')
  136.                             ->defaultValue('https://a.tile.openstreetmap.org/{z}/{x}/{y}.png')
  137.                         ->end()
  138.                         ->scalarNode('geocoding_url_template')
  139.                             ->defaultValue('https://nominatim.openstreetmap.org/search?q={q}&addressdetails=1&format=json&limit=1')
  140.                         ->end()
  141.                         ->scalarNode('reverse_geocoding_url_template')
  142.                             ->defaultValue('https://nominatim.openstreetmap.org/reverse?format=json&lat={lat}&lon={lon}&addressdetails=1')
  143.                         ->end()
  144.                     ->end()
  145.                 ->end()
  146.             ->end();
  147.         $this->addGeneralNode($rootNode);
  148.         $this->addMaintenanceNode($rootNode);
  149.         $this->addServicesNode($rootNode);
  150.         $this->addObjectsNode($rootNode);
  151.         $this->addAssetNode($rootNode);
  152.         $this->addDocumentsNode($rootNode);
  153.         $this->addEncryptionNode($rootNode);
  154.         $this->addModelsNode($rootNode);
  155.         $this->addRoutingNode($rootNode);
  156.         $this->addCacheNode($rootNode);
  157.         $this->addContextNode($rootNode);
  158.         $this->addAdminNode($rootNode);
  159.         $this->addWebProfilerNode($rootNode);
  160.         $this->addSecurityNode($rootNode);
  161.         $this->addEmailNode($rootNode);
  162.         $this->addNewsletterNode($rootNode);
  163.         $this->addCustomReportsNode($rootNode);
  164.         $this->addMigrationsNode($rootNode);
  165.         $this->addTargetingNode($rootNode);
  166.         $this->addSitemapsNode($rootNode);
  167.         $this->addMimeNode($rootNode);
  168.         $this->addWorkflowNode($rootNode);
  169.         $this->addHttpClientNode($rootNode);
  170.         $this->addApplicationLogNode($rootNode);
  171.         return $treeBuilder;
  172.     }
  173.     /**
  174.      * Add maintenance config
  175.      *
  176.      * @param ArrayNodeDefinition $rootNode
  177.      */
  178.     private function addMaintenanceNode(ArrayNodeDefinition $rootNode)
  179.     {
  180.         $rootNode
  181.             ->children()
  182.             ->arrayNode('maintenance')
  183.             ->addDefaultsIfNotSet()
  184.             ->children()
  185.                 ->arrayNode('housekeeping')
  186.                 ->addDefaultsIfNotSet()
  187.                 ->children()
  188.                     ->integerNode('cleanup_tmp_files_atime_older_than')
  189.                         ->defaultValue(7776000// 90 days
  190.                     ->end()
  191.                     ->integerNode('cleanup_profiler_files_atime_older_than')
  192.                         ->defaultValue(1800)
  193.                     ->end()
  194.         ;
  195.     }
  196.     /**
  197.      * Add general config
  198.      *
  199.      * @param ArrayNodeDefinition $rootNode
  200.      */
  201.     private function addGeneralNode(ArrayNodeDefinition $rootNode)
  202.     {
  203.         $rootNode
  204.             ->children()
  205.             ->arrayNode('general')
  206.             ->ignoreExtraKeys()
  207.             ->addDefaultsIfNotSet()
  208.             ->children()
  209.                 ->scalarNode('timezone')
  210.                     ->defaultValue('Europe/Berlin')
  211.                 ->end()
  212.                 ->scalarNode('path_variable')
  213.                     ->defaultNull()
  214.                 ->end()
  215.                 ->scalarNode('domain')
  216.                     ->defaultNull()
  217.                 ->end()
  218.                 ->booleanNode('redirect_to_maindomain')
  219.                     ->beforeNormalization()
  220.                         ->ifString()
  221.                         ->then(function ($v) {
  222.                             return (bool)$v;
  223.                         })
  224.                     ->end()
  225.                     ->defaultFalse()
  226.                 ->end()
  227.                 ->scalarNode('language')
  228.                     ->defaultValue('en')
  229.                 ->end()
  230.                 ->scalarNode('valid_languages')
  231.                     ->defaultValue('en')
  232.                 ->end()
  233.                 ->arrayNode('fallback_languages')
  234.                     ->performNoDeepMerging()
  235.                     ->beforeNormalization()
  236.                     ->ifArray()
  237.                         ->then(function ($v) {
  238.                             return $v;
  239.                         })
  240.                     ->end()
  241.                     ->prototype('scalar')
  242.                     ->end()
  243.                 ->end()
  244.                 ->scalarNode('default_language')
  245.                     ->defaultValue('en')
  246.                 ->end()
  247.                 ->booleanNode('disable_usage_statistics')
  248.                     ->beforeNormalization()
  249.                         ->ifString()
  250.                         ->then(function ($v) {
  251.                             return (bool)$v;
  252.                         })
  253.                     ->end()
  254.                     ->defaultFalse()
  255.                 ->end()
  256.                 ->booleanNode('debug_admin_translations')
  257.                     ->beforeNormalization()
  258.                         ->ifString()
  259.                         ->then(function ($v) {
  260.                             return (bool)$v;
  261.                         })
  262.                     ->end()
  263.                     ->defaultFalse()
  264.                 ->end()
  265.                 ->scalarNode('instance_identifier')
  266.                     ->defaultNull()->end()
  267.                 ->booleanNode('show_cookie_notice')
  268.                     ->setDeprecated('The cookie bar will be removed in Pimcore 7')
  269.                     ->beforeNormalization()
  270.                         ->ifString()
  271.                         ->then(function ($v) {
  272.                             return (bool)$v;
  273.                         })
  274.                     ->end()
  275.                     ->defaultFalse()
  276.                 ->end()
  277.             ->end();
  278.     }
  279.     /**
  280.      * @param ArrayNodeDefinition $rootNode
  281.      */
  282.     private function addServicesNode(ArrayNodeDefinition $rootNode)
  283.     {
  284.         $rootNode
  285.             ->children()
  286.             ->arrayNode('services')
  287.                 ->children()
  288.                     ->arrayNode('google')
  289.                     ->children()
  290.                         ->scalarNode('client_id')
  291.                             ->defaultNull()
  292.                         ->end()
  293.                         ->scalarNode('email')
  294.                             ->defaultNull()
  295.                         ->end()
  296.                         ->scalarNode('simple_api_key')
  297.                             ->defaultNull()
  298.                         ->end()
  299.                         ->scalarNode('browser_api_key')
  300.                             ->defaultNull()
  301.                         ->end()
  302.                     ->end()
  303.                     ->end()
  304.                 ->end()
  305.             ->end()
  306.             ->arrayNode('webservice')
  307.                 ->canBeEnabled()
  308.             ->end();
  309.     }
  310.     /**
  311.      * @param ArrayNodeDefinition $rootNode
  312.      */
  313.     private function addModelsNode(ArrayNodeDefinition $rootNode)
  314.     {
  315.         $rootNode
  316.             ->children()
  317.                 ->arrayNode('models')
  318.                     ->addDefaultsIfNotSet()
  319.                     ->children()
  320.                         ->arrayNode('class_overrides')
  321.                             ->useAttributeAsKey('name')
  322.                             ->prototype('scalar');
  323.     }
  324.     /**
  325.      * @param ArrayNodeDefinition $rootNode
  326.      */
  327.     private function addHttpClientNode(ArrayNodeDefinition $rootNode)
  328.     {
  329.         $rootNode
  330.             ->children()
  331.                 ->arrayNode('httpclient')
  332.                 ->addDefaultsIfNotSet()
  333.                     ->children()
  334.                         ->scalarNode('adapter')
  335.                             ->defaultValue('Socket')
  336.                         ->end()
  337.                         ->scalarNode('proxy_host')
  338.                             ->defaultNull()
  339.                         ->end()
  340.                         ->scalarNode('proxy_port')
  341.                             ->defaultNull()
  342.                         ->end()
  343.                         ->scalarNode('proxy_user')
  344.                             ->defaultNull()
  345.                         ->end()
  346.                         ->scalarNode('proxy_pass')
  347.                             ->defaultNull()
  348.                         ->end()
  349.                     ->end()
  350.                 ->end()
  351.             ->end();
  352.     }
  353.     /**
  354.      * @param ArrayNodeDefinition $rootNode
  355.      */
  356.     private function addApplicationLogNode(ArrayNodeDefinition $rootNode)
  357.     {
  358.         $rootNode
  359.             ->children()
  360.                 ->arrayNode('applicationlog')
  361.                 ->addDefaultsIfNotSet()
  362.                     ->children()
  363.                         ->arrayNode('mail_notification')
  364.                             ->children()
  365.                                 ->booleanNode('send_log_summary')
  366.                                     ->beforeNormalization()
  367.                                         ->ifString()
  368.                                         ->then(function ($v) {
  369.                                             return (bool)$v;
  370.                                         })
  371.                                     ->end()
  372.                                     ->defaultFalse()
  373.                                 ->end()
  374.                                 ->scalarNode('filter_priority')
  375.                                     ->defaultNull()
  376.                                 ->end()
  377.                                 ->scalarNode('mail_receiver')
  378.                                 ->end()
  379.                             ->end()
  380.                         ->end()
  381.                         ->scalarNode('archive_treshold')
  382.                             ->defaultValue('')
  383.                         ->end()
  384.                         ->scalarNode('archive_alternative_database')
  385.                             ->defaultValue('')
  386.                         ->end()
  387.                     ->end()
  388.             ->end();
  389.     }
  390.     /**
  391.      * Add asset specific extension config
  392.      *
  393.      * @param ArrayNodeDefinition $rootNode
  394.      */
  395.     private function addAssetNode(ArrayNodeDefinition $rootNode)
  396.     {
  397.         $assetsNode $rootNode
  398.             ->children()
  399.                 ->arrayNode('assets')
  400.                 ->ignoreExtraKeys()
  401.                 ->addDefaultsIfNotSet()
  402.                 ->children()
  403.                     ->scalarNode('preview_image_thumbnail')
  404.                         ->defaultNull()
  405.                         ->end()
  406.                     ->scalarNode('default_upload_path')
  407.                         ->defaultValue('_default_upload_bucket')
  408.                         ->end()
  409.                     ->integerNode('tree_paging_limit')
  410.                         ->defaultValue(100)
  411.                         ->end()
  412.                     ->arrayNode('image')
  413.                         ->addDefaultsIfNotSet()
  414.                         ->children()
  415.                             ->arrayNode('low_quality_image_preview')
  416.                                 ->addDefaultsIfNotSet()
  417.                                 ->canBeDisabled()
  418.                                 ->children()
  419.                                     ->scalarNode('generator')
  420.                                     ->defaultNull()
  421.                                     ->end()
  422.                                 ->end()
  423.                             ->end()
  424.                             ->arrayNode('focal_point_detection')
  425.                                 ->addDefaultsIfNotSet()
  426.                                 ->canBeDisabled()
  427.                             ->end()
  428.                             ->arrayNode('thumbnails')
  429.                                 ->addDefaultsIfNotSet()
  430.                                 ->children()
  431.                                     ->booleanNode('webp_auto_support')
  432.                                         ->beforeNormalization()
  433.                                             ->ifString()
  434.                                             ->then(function ($v) {
  435.                                                 return (bool)$v;
  436.                                             })
  437.                                         ->end()
  438.                                         ->defaultTrue()
  439.                                     ->end()
  440.                                     ->booleanNode('clip_auto_support')
  441.                                         ->beforeNormalization()
  442.                                             ->ifString()
  443.                                             ->then(function ($v) {
  444.                                                 return (bool)$v;
  445.                                             })
  446.                                         ->end()
  447.                                         ->defaultTrue()
  448.                                     ->end()
  449.                                     ->booleanNode('auto_clear_temp_files')
  450.                                         ->beforeNormalization()
  451.                                             ->ifString()
  452.                                             ->then(function ($v) {
  453.                                                 return (bool)$v;
  454.                                             })
  455.                                         ->end()
  456.                                         ->defaultTrue()
  457.                                     ->end()
  458.                                 ->end()
  459.                             ->end()
  460.                         ->end()
  461.                     ->end()
  462.                     ->arrayNode('video')
  463.                         ->addDefaultsIfNotSet()
  464.                         ->children()
  465.                             ->arrayNode('thumbnails')
  466.                                 ->addDefaultsIfNotSet()
  467.                                 ->children()
  468.                                     ->booleanNode('auto_clear_temp_files')
  469.                                     ->defaultTrue()
  470.                                     ->end()
  471.                                 ->end()
  472.                             ->end()
  473.                         ->end()
  474.                     ->end()
  475.                     ->arrayNode('versions')
  476.                         ->addDefaultsIfNotSet()
  477.                         ->children()
  478.                             ->scalarNode('days')
  479.                                 ->defaultNull()
  480.                             ->end()
  481.                             ->scalarNode('steps')
  482.                                 ->defaultNull()
  483.                             ->end()
  484.                             ->booleanNode('use_hardlinks')
  485.                                 ->beforeNormalization()
  486.                                     ->ifString()
  487.                                     ->then(function ($v) {
  488.                                         return (bool)$v;
  489.                                     })
  490.                                 ->end()
  491.                                 ->defaultTrue()
  492.                             ->end()
  493.                             ->booleanNode('disable_stack_trace')
  494.                                 ->beforeNormalization()
  495.                                     ->ifString()
  496.                                     ->then(function ($v) {
  497.                                         return (bool)$v;
  498.                                     })
  499.                                 ->end()
  500.                                 ->defaultFalse()
  501.                             ->end()
  502.                         ->end()
  503.                     ->end()
  504.                     ->scalarNode('icc_rgb_profile')
  505.                         ->defaultNull()
  506.                     ->end()
  507.                     ->scalarNode('icc_cmyk_profile')
  508.                         ->defaultNull()
  509.                     ->end()
  510.                     ->booleanNode('hide_edit_image')
  511.                         ->defaultFalse()
  512.                     ->end()
  513.                     ->booleanNode('disable_tree_preview')
  514.                         ->defaultTrue()
  515.                     ->end()
  516.                 ->end();
  517.         $assetsNode
  518.             ->children()
  519.                 ->arrayNode('metadata')
  520.                 ->addDefaultsIfNotSet()
  521.                     ->children()
  522.                         ->arrayNode('class_definitions')
  523.                             ->children()
  524.                                 ->arrayNode('data')
  525.                                     ->children()
  526.                                         ->arrayNode('map')
  527.                                             ->useAttributeAsKey('name')
  528.                                             ->prototype('scalar')->end()
  529.                                         ->end()
  530.                                         ->arrayNode('prefixes')
  531.                                             ->prototype('scalar')->end()
  532.                                         ->end()
  533.                                     ->end()
  534.                                 ->end()
  535.                             ->end()
  536.                         ->end();
  537.     }
  538.     /**
  539.      * Add object specific extension config
  540.      *
  541.      * @param ArrayNodeDefinition $rootNode
  542.      */
  543.     private function addObjectsNode(ArrayNodeDefinition $rootNode)
  544.     {
  545.         $objectsNode $rootNode
  546.             ->children()
  547.                 ->arrayNode('objects')
  548.                     ->ignoreExtraKeys()
  549.                     ->addDefaultsIfNotSet()
  550.                     ->children()
  551.                         ->integerNode('tree_paging_limit')
  552.                             ->defaultValue(30)
  553.                         ->end()
  554.                         ->arrayNode('versions')
  555.                             ->children()
  556.                                 ->scalarNode('days')->defaultNull()->end()
  557.                                 ->scalarNode('steps')->defaultNull()->end()
  558.                                 ->booleanNode('disable_stack_trace')
  559.                                     ->beforeNormalization()
  560.                                     ->ifString()
  561.                                         ->then(function ($v) {
  562.                                             return (bool)$v;
  563.                                         })
  564.                                     ->end()
  565.                                     ->defaultFalse()
  566.                                 ->end()
  567.                             ->end()
  568.                         ->end()
  569.                     ->end();
  570.         $classDefinitionsNode $objectsNode
  571.             ->children()
  572.                 ->arrayNode('class_definitions')
  573.                     ->addDefaultsIfNotSet();
  574.         $this->addImplementationLoaderNode($classDefinitionsNode'data');
  575.         $this->addImplementationLoaderNode($classDefinitionsNode'layout');
  576.     }
  577.     /**
  578.      * Add encryption specific extension config
  579.      *
  580.      * @param ArrayNodeDefinition $rootNode
  581.      */
  582.     private function addEncryptionNode(ArrayNodeDefinition $rootNode)
  583.     {
  584.         $encryptionNode $rootNode
  585.             ->children()
  586.             ->arrayNode('encryption')->addDefaultsIfNotSet();
  587.         $encryptionNode
  588.             ->children()
  589.             ->scalarNode('secret')->defaultNull();
  590.     }
  591.     /**
  592.      * Add document specific extension config
  593.      *
  594.      * @param ArrayNodeDefinition $rootNode
  595.      */
  596.     private function addDocumentsNode(ArrayNodeDefinition $rootNode)
  597.     {
  598.         $documentsNode $rootNode
  599.             ->children()
  600.                 ->arrayNode('documents')
  601.                     ->ignoreExtraKeys()
  602.                     ->addDefaultsIfNotSet();
  603.         $documentsNode
  604.             ->children()
  605.                 ->arrayNode('tags')
  606.                     ->setDeprecated('The "%node%" option is deprecated. Use "editables" instead.')
  607.                     ->addDefaultsIfNotSet()
  608.                     ->children()
  609.                         ->arrayNode('map')
  610.                             ->useAttributeAsKey('name')
  611.                             ->prototype('scalar')->end()
  612.                         ->end()
  613.                         ->arrayNode('prefixes')
  614.                             ->prototype('scalar')->end()
  615.                         ->end()
  616.                     ->end()
  617.                 ->end()
  618.                 ->arrayNode('versions')
  619.                     ->children()
  620.                         ->scalarNode('days')
  621.                             ->defaultNull()
  622.                         ->end()
  623.                         ->scalarNode('steps')
  624.                             ->defaultNull()
  625.                         ->end()
  626.                         ->booleanNode('disable_stack_trace')
  627.                             ->beforeNormalization()
  628.                             ->ifString()
  629.                                 ->then(function ($v) {
  630.                                     return (bool)$v;
  631.                                 })
  632.                             ->end()
  633.                             ->defaultFalse()
  634.                         ->end()
  635.                     ->end()
  636.                 ->end()
  637.                 ->arrayNode('error_pages')
  638.                     ->children()
  639.                         ->scalarNode('default')
  640.                             ->defaultNull()
  641.                         ->end()
  642.                     ->end()
  643.                 ->end()
  644.                 ->booleanNode('create_redirect_when_moved')
  645.                     ->setDeprecated('The "%node%" option is deprecated and not used anymore, it is just there for compatibility.')
  646.                     ->beforeNormalization()
  647.                         ->ifString()
  648.                         ->then(function ($v) {
  649.                             return (bool)$v;
  650.                         })
  651.                     ->end()
  652.                     ->defaultFalse()
  653.                 ->end()
  654.                 ->scalarNode('allow_trailing_slash')
  655.                     ->defaultValue('no')
  656.                 ->end()
  657.                 ->booleanNode('generate_preview')
  658.                     ->beforeNormalization()
  659.                         ->ifString()
  660.                         ->then(function ($v) {
  661.                             return (bool)$v;
  662.                         })
  663.                     ->end()
  664.                     ->defaultFalse()
  665.                 ->end()
  666.                 ->integerNode('tree_paging_limit')
  667.                     ->defaultValue(50)
  668.                 ->end()
  669.                 ->arrayNode('editables')
  670.                     ->addDefaultsIfNotSet()
  671.                     ->children()
  672.                         ->arrayNode('map')
  673.                             ->useAttributeAsKey('name')
  674.                             ->prototype('scalar')->end()
  675.                         ->end()
  676.                         ->arrayNode('prefixes')
  677.                             ->prototype('scalar')->end()
  678.                         ->end()
  679.                         ->enumNode('naming_strategy')
  680.                             ->info('Sets naming strategy used to build editable names')
  681.                             ->values(['legacy''nested'])
  682.                             ->defaultValue('nested')
  683.                             ->setDeprecated('The "%node%" option is deprecated. Migrate to the new editable naming scheme!')
  684.                         ->end()
  685.                     ->end()
  686.                 ->end()
  687.                 ->arrayNode('areas')
  688.                     ->addDefaultsIfNotSet()
  689.                     ->children()
  690.                         ->booleanNode('autoload')
  691.                             ->beforeNormalization()
  692.                                 ->ifString()
  693.                                 ->then(function ($v) {
  694.                                     return (bool)$v;
  695.                                 })
  696.                             ->end()
  697.                             ->defaultTrue()
  698.                         ->end()
  699.                     ->end()
  700.                 ->end()
  701.                 ->arrayNode('newsletter')
  702.                     ->addDefaultsIfNotSet()
  703.                     ->children()
  704.                         ->scalarNode('defaultUrlPrefix')
  705.                             ->defaultNull()
  706.                         ->end()
  707.                     ->end()
  708.                 ->end()
  709.                 ->arrayNode('web_to_print')
  710.                     ->addDefaultsIfNotSet()
  711.                         ->children()
  712.                             ->scalarNode('pdf_creation_php_memory_limit')
  713.                             ->defaultValue('2048M')
  714.                         ->end()
  715.                     ->end()
  716.                 ->end()
  717.             ->end();
  718.     }
  719.     /**
  720.      * Add implementation node config (map, prefixes)
  721.      *
  722.      * @param ArrayNodeDefinition $node
  723.      * @param string $name
  724.      */
  725.     private function addImplementationLoaderNode(ArrayNodeDefinition $node$name)
  726.     {
  727.         $node
  728.             ->children()
  729.                 ->arrayNode($name)
  730.                     ->addDefaultsIfNotSet()
  731.                     ->children()
  732.                         ->arrayNode('map')
  733.                             ->useAttributeAsKey('name')
  734.                             ->prototype('scalar')->end()
  735.                         ->end()
  736.                         ->arrayNode('prefixes')
  737.                             ->prototype('scalar')->end()
  738.                         ->end()
  739.                     ->end()
  740.                 ->end()
  741.             ->end();
  742.     }
  743.     private function addRoutingNode(ArrayNodeDefinition $rootNode)
  744.     {
  745.         $rootNode
  746.             ->children()
  747.                 ->arrayNode('routing')
  748.                     ->addDefaultsIfNotSet()
  749.                     ->children()
  750.                         ->arrayNode('defaults')
  751.                             ->addDefaultsIfNotSet()
  752.                             ->children()
  753.                                 ->scalarNode('bundle')
  754.                                     ->defaultValue('AppBundle')
  755.                                 ->end()
  756.                                 ->scalarNode('controller')
  757.                                     ->defaultValue('Default')
  758.                                 ->end()
  759.                                 ->scalarNode('action')
  760.                                     ->defaultValue('default')
  761.                                 ->end()
  762.                             ->end()
  763.                         ->end()
  764.                         ->arrayNode('static')
  765.                             ->addDefaultsIfNotSet()
  766.                             ->children()
  767.                                 ->arrayNode('locale_params')
  768.                                     ->info('Route params from this list will be mapped to _locale if _locale is not set explicitely')
  769.                                     ->prototype('scalar')
  770.                                     ->defaultValue([])
  771.                                 ->end()
  772.                             ->end()
  773.                         ->end()
  774.                     ->end()
  775.                 ->end();
  776.     }
  777.     /**
  778.      * Add context config
  779.      *
  780.      * @param ArrayNodeDefinition $rootNode
  781.      */
  782.     private function addContextNode(ArrayNodeDefinition $rootNode)
  783.     {
  784.         $contextNode $rootNode->children()
  785.             ->arrayNode('context');
  786.         /** @var ArrayNodeDefinition|NodeDefinition $prototype */
  787.         $prototype $contextNode->prototype('array');
  788.         // define routes child on each context entry
  789.         $this->addRoutesChild($prototype'routes');
  790.     }
  791.     /**
  792.      * Add admin config
  793.      *
  794.      * @param ArrayNodeDefinition $rootNode
  795.      */
  796.     private function addAdminNode(ArrayNodeDefinition $rootNode)
  797.     {
  798.         $adminNode $rootNode->children()
  799.             ->arrayNode('admin')
  800.             ->ignoreExtraKeys()
  801.             ->addDefaultsIfNotSet();
  802.         // add session attribute bag config
  803.         $this->addAdminSessionAttributeBags($adminNode);
  804.         // unauthenticated routes won't be double checked for authentication in AdminControllerListener
  805.         $this->addRoutesChild($adminNode'unauthenticated_routes');
  806.         $adminNode
  807.             ->children()
  808.                 ->arrayNode('translations')
  809.                     ->addDefaultsIfNotSet()
  810.                     ->children()
  811.                         ->scalarNode('path')->defaultNull()->end()
  812.                     ->end()
  813.                 ->end()
  814.             ->end();
  815.     }
  816.     /**
  817.      * @param ArrayNodeDefinition $adminNode
  818.      */
  819.     private function addAdminSessionAttributeBags(ArrayNodeDefinition $adminNode)
  820.     {
  821.         // Normalizes session bag config. Allows the following formats (all formats will be
  822.         // normalized to the third format.
  823.         //
  824.         // attribute_bags:
  825.         //      - foo
  826.         //      - bar
  827.         //
  828.         // attribute_bags:
  829.         //      foo: _foo
  830.         //      bar: _bar
  831.         //
  832.         // attribute_bags:
  833.         //      foo:
  834.         //          storage_key: _foo
  835.         //      bar:
  836.         //          storage_key: _bar
  837.         $normalizers = [
  838.             'assoc' => function (array $array) {
  839.                 $result = [];
  840.                 foreach ($array as $name => $value) {
  841.                     if (null === $value) {
  842.                         $value = [
  843.                             'storage_key' => '_' $name,
  844.                         ];
  845.                     }
  846.                     if (is_string($value)) {
  847.                         $value = [
  848.                             'storage_key' => $value,
  849.                         ];
  850.                     }
  851.                     $result[$name] = $value;
  852.                 }
  853.                 return $result;
  854.             },
  855.             'sequential' => function (array $array) {
  856.                 $result = [];
  857.                 foreach ($array as $name) {
  858.                     $result[$name] = [
  859.                         'storage_key' => '_' $name,
  860.                     ];
  861.                 }
  862.                 return $result;
  863.             },
  864.         ];
  865.         $adminNode
  866.             ->children()
  867.                 ->arrayNode('session')
  868.                     ->addDefaultsIfNotSet()
  869.                     ->children()
  870.                         ->arrayNode('attribute_bags')
  871.                             ->useAttributeAsKey('name')
  872.                             ->beforeNormalization()
  873.                                 ->ifArray()->then(function ($v) use ($normalizers) {
  874.                                     if (isAssocArray($v)) {
  875.                                         return $normalizers['assoc']($v);
  876.                                     } else {
  877.                                         return $normalizers['sequential']($v);
  878.                                     }
  879.                                 })
  880.                             ->end()
  881.                             ->example([
  882.                                 ['foo''bar'],
  883.                                 [
  884.                                     'foo' => '_foo',
  885.                                     'bar' => '_bar',
  886.                                 ],
  887.                                 [
  888.                                     'foo' => [
  889.                                         'storage_key' => '_foo',
  890.                                     ],
  891.                                     'bar' => [
  892.                                         'storage_key' => '_bar',
  893.                                     ],
  894.                                 ],
  895.                             ])
  896.                             ->prototype('array')
  897.                                 ->children()
  898.                                     ->scalarNode('storage_key')
  899.                                         ->defaultNull()
  900.                                     ->end()
  901.                                 ->end()
  902.                             ->end()
  903.                         ->end()
  904.                     ->end()
  905.                 ->end()
  906.             ->end();
  907.     }
  908.     private function addSecurityNode(ArrayNodeDefinition $rootNode)
  909.     {
  910.         $rootNode
  911.             ->children()
  912.                 ->arrayNode('security')
  913.                     ->addDefaultsIfNotSet()
  914.                     ->children()
  915.                         ->arrayNode('encoder_factories')
  916.                             ->info('Encoder factories to use as className => factory service ID mapping')
  917.                             ->example([
  918.                                 'AppBundle\Model\DataObject\User1' => [
  919.                                     'id' => 'website_demo.security.encoder_factory2',
  920.                                 ],
  921.                                 'AppBundle\Model\DataObject\User2' => 'website_demo.security.encoder_factory2',
  922.                             ])
  923.                             ->useAttributeAsKey('class')
  924.                             ->prototype('array')
  925.                             ->beforeNormalization()->ifString()->then(function ($v) {
  926.                                 return ['id' => $v];
  927.                             })->end()
  928.                             ->children()
  929.                                 ->scalarNode('id')->end()
  930.                             ->end()
  931.                         ->end()
  932.                     ->end()
  933.                 ->end()
  934.             ->end()
  935.         ;
  936.     }
  937.     /**
  938.      * Configure exclude paths for web profiler toolbar
  939.      *
  940.      * @param ArrayNodeDefinition $rootNode
  941.      */
  942.     private function addWebProfilerNode(ArrayNodeDefinition $rootNode)
  943.     {
  944.         $webProfilerNode $rootNode->children()
  945.             ->arrayNode('web_profiler')
  946.                 ->example([
  947.                     'toolbar' => [
  948.                         'excluded_routes' => [
  949.                             ['path' => '^/test/path'],
  950.                         ],
  951.                     ],
  952.                 ])
  953.                 ->addDefaultsIfNotSet();
  954.         $toolbarNode $webProfilerNode->children()
  955.             ->arrayNode('toolbar')
  956.                 ->addDefaultsIfNotSet();
  957.         $this->addRoutesChild($toolbarNode'excluded_routes');
  958.     }
  959.     /**
  960.      * Add a route prototype child
  961.      *
  962.      * @param ArrayNodeDefinition $parent
  963.      * @param string $name
  964.      */
  965.     private function addRoutesChild(ArrayNodeDefinition $parent$name)
  966.     {
  967.         $node $parent->children()->arrayNode($name);
  968.         /** @var ArrayNodeDefinition|NodeDefinition $prototype */
  969.         $prototype $node->prototype('array');
  970.         $prototype
  971.             ->beforeNormalization()
  972.                 ->ifNull()->then(function () {
  973.                     return [];
  974.                 })
  975.             ->end()
  976.             ->children()
  977.                 ->scalarNode('path')->defaultFalse()->end()
  978.                 ->scalarNode('route')->defaultFalse()->end()
  979.                 ->scalarNode('host')->defaultFalse()->end()
  980.                 ->arrayNode('methods')
  981.                     ->prototype('scalar')->end()
  982.                 ->end()
  983.             ->end();
  984.     }
  985.     /**
  986.      * Add cache config
  987.      *
  988.      * @param ArrayNodeDefinition $rootNode
  989.      */
  990.     private function addCacheNode(ArrayNodeDefinition $rootNode)
  991.     {
  992.         $defaultOptions ConnectionFactory::getDefaultOptions();
  993.         $rootNode->children()
  994.             ->arrayNode('full_page_cache')
  995.                 ->ignoreExtraKeys()
  996.                 ->canBeDisabled()
  997.                 ->addDefaultsIfNotSet()
  998.                 ->children()
  999.                     ->scalarNode('lifetime')
  1000.                         ->defaultNull()
  1001.                     ->end()
  1002.                     ->scalarNode('exclude_patterns')->end()
  1003.                     ->scalarNode('exclude_cookie')->end()
  1004.                 ->end()
  1005.             ->end()
  1006.             ->arrayNode('cache')
  1007.                 ->ignoreExtraKeys()
  1008.                 ->addDefaultsIfNotSet()
  1009.                 ->children()
  1010.                     ->scalarNode('pool_service_id')
  1011.                         ->defaultValue(null)
  1012.                     ->end()
  1013.                     ->integerNode('default_lifetime')
  1014.                         ->defaultValue(2419200// 28 days
  1015.                     ->end()
  1016.                     ->arrayNode('pools')
  1017.                         ->addDefaultsIfNotSet()
  1018.                         ->children()
  1019.                             ->arrayNode('doctrine')
  1020.                                 ->canBeDisabled()
  1021.                                 ->children()
  1022.                                     ->scalarNode('connection')
  1023.                                         ->defaultValue('default')
  1024.                                     ->end()
  1025.                                 ->end()
  1026.                             ->end()
  1027.                             ->arrayNode('redis')
  1028.                                 ->canBeEnabled()
  1029.                                 ->children()
  1030.                                     ->arrayNode('connection')
  1031.                                         ->info('Redis connection options. See ' ConnectionFactory::class)
  1032.                                         ->children()
  1033.                                             ->scalarNode('server')->end()
  1034.                                             ->integerNode('port')
  1035.                                                 ->defaultValue($defaultOptions['port'])
  1036.                                             ->end()
  1037.                                             ->scalarNode('database')
  1038.                                                 ->defaultValue($defaultOptions['database'])
  1039.                                             ->end()
  1040.                                             ->scalarNode('password')
  1041.                                                 ->defaultValue($defaultOptions['password'])
  1042.                                             ->end()
  1043.                                             ->scalarNode('persistent')
  1044.                                                 ->defaultValue($defaultOptions['persistent'])
  1045.                                             ->end()
  1046.                                             ->booleanNode('force_standalone')
  1047.                                                 ->defaultValue($defaultOptions['force_standalone'])
  1048.                                             ->end()
  1049.                                             ->integerNode('connect_retries')
  1050.                                                 ->defaultValue($defaultOptions['connect_retries'])
  1051.                                             ->end()
  1052.                                             ->floatNode('timeout')
  1053.                                                 ->defaultValue($defaultOptions['timeout'])
  1054.                                             ->end()
  1055.                                             ->floatNode('read_timeout')
  1056.                                                 ->defaultValue($defaultOptions['read_timeout'])
  1057.                                             ->end()
  1058.                                         ->end()
  1059.                                     ->end()
  1060.                                     ->arrayNode('options')
  1061.                                         ->info('Redis cache pool options. See ' Redis::class)
  1062.                                         ->children()
  1063.                                             ->booleanNode('notMatchingTags')->end()
  1064.                                             ->integerNode('compress_tags')->end()
  1065.                                             ->integerNode('compress_data')->end()
  1066.                                             ->integerNode('compress_threshold')->end()
  1067.                                             ->scalarNode('compression_lib')->end()
  1068.                                             ->booleanNode('use_lua')->end()
  1069.                                             ->integerNode('lua_max_c_stack')->end()
  1070.                                         ->end()
  1071.                                     ->end()
  1072.                                 ->end()
  1073.                             ->end()
  1074.                         ->end()
  1075.                     ->end()
  1076.                 ->end();
  1077.     }
  1078.     /**
  1079.      * Adds configuration for email source adapters
  1080.      *
  1081.      * @param ArrayNodeDefinition $rootNode
  1082.      */
  1083.     private function addEmailNode(ArrayNodeDefinition $rootNode)
  1084.     {
  1085.         $rootNode
  1086.             ->children()
  1087.                 ->arrayNode('email')
  1088.                 ->addDefaultsIfNotSet()
  1089.                     ->children()
  1090.                         ->arrayNode('sender')
  1091.                             ->children()
  1092.                                 ->scalarNode('name')->end()
  1093.                                 ->scalarNode('email')->end()
  1094.                             ->end()
  1095.                         ->end()
  1096.                         ->arrayNode('return')
  1097.                             ->children()
  1098.                                 ->scalarNode('name')->end()
  1099.                                 ->scalarNode('email')->end()
  1100.                             ->end()
  1101.                         ->end()
  1102.                         ->scalarNode('method')
  1103.                             ->defaultNull()
  1104.                         ->end()
  1105.                         ->arrayNode('debug')
  1106.                             ->children()
  1107.                                 ->scalarNode('email_addresses')
  1108.                                     ->defaultValue('')
  1109.                                 ->end()
  1110.                             ->end()
  1111.                         ->end()
  1112.                         ->scalarNode('usespecific')
  1113.                         ->end()
  1114.                     ->end()
  1115.                 ->end()
  1116.             ->end();
  1117.     }
  1118.     /**
  1119.      * Adds configuration tree for newsletter source adapters
  1120.      *
  1121.      * @param ArrayNodeDefinition $rootNode
  1122.      */
  1123.     private function addNewsletterNode(ArrayNodeDefinition $rootNode)
  1124.     {
  1125.         $rootNode
  1126.             ->children()
  1127.                 ->arrayNode('newsletter')
  1128.                     ->addDefaultsIfNotSet()
  1129.                     ->children()
  1130.                         ->arrayNode('sender')
  1131.                             ->children()
  1132.                                 ->scalarNode('name')->end()
  1133.                                 ->scalarNode('email')->end()
  1134.                             ->end()
  1135.                         ->end()
  1136.                         ->arrayNode('return')
  1137.                             ->children()
  1138.                                 ->scalarNode('name')->end()
  1139.                                 ->scalarNode('email')->end()
  1140.                             ->end()
  1141.                         ->end()
  1142.                         ->scalarNode('method')
  1143.                             ->defaultNull()
  1144.                         ->end()
  1145.                         ->arrayNode('debug')
  1146.                             ->children()
  1147.                                 ->scalarNode('email_addresses')
  1148.                                     ->defaultValue('')
  1149.                                 ->end()
  1150.                             ->end()
  1151.                         ->end()
  1152.                         ->booleanNode('use_specific')
  1153.                             ->beforeNormalization()
  1154.                                 ->ifString()
  1155.                                 ->then(function ($v) {
  1156.                                     return (bool)$v;
  1157.                                 })
  1158.                             ->end()
  1159.                         ->end()
  1160.                         ->arrayNode('source_adapters')
  1161.                             ->useAttributeAsKey('name')
  1162.                                 ->prototype('scalar')
  1163.                             ->end()
  1164.                         ->end()
  1165.                     ->end()
  1166.                 ->end()
  1167.             ->end();
  1168.     }
  1169.     /**
  1170.      * Adds configuration tree for custom report adapters
  1171.      *
  1172.      * @param ArrayNodeDefinition $rootNode
  1173.      */
  1174.     private function addCustomReportsNode(ArrayNodeDefinition $rootNode)
  1175.     {
  1176.         $rootNode
  1177.             ->children()
  1178.                 ->arrayNode('custom_report')
  1179.                     ->addDefaultsIfNotSet()
  1180.                     ->children()
  1181.                         ->arrayNode('adapters')
  1182.                             ->useAttributeAsKey('name')
  1183.                                 ->prototype('scalar')
  1184.                             ->end()
  1185.                         ->end()
  1186.                     ->end()
  1187.                 ->end()
  1188.             ->end();
  1189.     }
  1190.     /**
  1191.      * Adds configuration tree node for migrations
  1192.      *
  1193.      * @param ArrayNodeDefinition $rootNode
  1194.      */
  1195.     private function addMigrationsNode(ArrayNodeDefinition $rootNode)
  1196.     {
  1197.         $rootNode
  1198.             ->children()
  1199.                 ->arrayNode('migrations')
  1200.                     ->addDefaultsIfNotSet()
  1201.                     ->children()
  1202.                         ->arrayNode('sets')
  1203.                             ->useAttributeAsKey('identifier')
  1204.                             ->defaultValue([])
  1205.                             ->info('Migration sets which can be used apart from bundle migrations. Use the -s option in migration commands to select a specific set.')
  1206.                             ->example([
  1207.                                 [
  1208.                                     'custom_set' => [
  1209.                                         'name' => 'Custom Migrations',
  1210.                                         'namespace' => 'App\\Migrations\\Custom',
  1211.                                         'directory' => 'src/App/Migrations/Custom',
  1212.                                     ],
  1213.                                     'custom_set_2' => [
  1214.                                         'name' => 'Custom Migrations 2',
  1215.                                         'namespace' => 'App\\Migrations\\Custom2',
  1216.                                         'directory' => 'src/App/Migrations/Custom2',
  1217.                                         'connection' => 'custom_connection',
  1218.                                     ],
  1219.                                 ],
  1220.                             ])
  1221.                             ->prototype('array')
  1222.                                 ->children()
  1223.                                     ->scalarNode('identifier')->end()
  1224.                                     ->scalarNode('name')
  1225.                                         ->isRequired()
  1226.                                         ->cannotBeEmpty()
  1227.                                     ->end()
  1228.                                     ->scalarNode('namespace')
  1229.                                         ->isRequired()
  1230.                                         ->cannotBeEmpty()
  1231.                                     ->end()
  1232.                                     ->scalarNode('directory')
  1233.                                         ->isRequired()
  1234.                                         ->cannotBeEmpty()
  1235.                                     ->end()
  1236.                                     ->scalarNode('connection')
  1237.                                         ->info('If defined, the DBAL connection defined here will be used')
  1238.                                         ->defaultNull()
  1239.                                         ->beforeNormalization()
  1240.                                             ->ifTrue(function ($v) {
  1241.                                                 return empty(trim($v));
  1242.                                             })
  1243.                                             ->then(function () {
  1244.                                                 return null;
  1245.                                             })
  1246.                                         ->end()
  1247.                                     ->end()
  1248.                                 ->end()
  1249.                             ->end()
  1250.                         ->end()
  1251.                     ->end()
  1252.                 ->end()
  1253.             ->end();
  1254.     }
  1255.     private function addTargetingNode(ArrayNodeDefinition $rootNode)
  1256.     {
  1257.         $rootNode
  1258.             ->children()
  1259.                 ->arrayNode('targeting')
  1260.                     ->canBeDisabled()
  1261.                     ->addDefaultsIfNotSet()
  1262.                     ->children()
  1263.                         ->scalarNode('storage_id')
  1264.                             ->info('Service ID of the targeting storage which should be used. This ID will be aliased to ' TargetingStorageInterface::class)
  1265.                             ->defaultValue(CookieStorage::class)
  1266.                             ->cannotBeEmpty()
  1267.                         ->end()
  1268.                         ->arrayNode('session')
  1269.                             ->info('Enables HTTP session support by configuring session bags and the full page cache')
  1270.                             ->canBeEnabled()
  1271.                         ->end()
  1272.                         ->arrayNode('data_providers')
  1273.                             ->useAttributeAsKey('key')
  1274.                                 ->prototype('scalar')
  1275.                             ->end()
  1276.                         ->end()
  1277.                         ->arrayNode('conditions')
  1278.                             ->useAttributeAsKey('key')
  1279.                                 ->prototype('scalar')
  1280.                             ->end()
  1281.                         ->end()
  1282.                         ->arrayNode('action_handlers')
  1283.                             ->useAttributeAsKey('name')
  1284.                                 ->prototype('scalar')
  1285.                             ->end()
  1286.                         ->end()
  1287.                     ->end()
  1288.                 ->end()
  1289.             ->end();
  1290.     }
  1291.     private function addSitemapsNode(ArrayNodeDefinition $rootNode)
  1292.     {
  1293.         $rootNode
  1294.             ->children()
  1295.                 ->arrayNode('sitemaps')
  1296.                     ->addDefaultsIfNotSet()
  1297.                     ->children()
  1298.                         ->arrayNode('generators')
  1299.                             ->useAttributeAsKey('name')
  1300.                             ->prototype('array')
  1301.                                 ->beforeNormalization()
  1302.                                     ->ifString()
  1303.                                     ->then(function ($v) {
  1304.                                         return [
  1305.                                             'enabled' => true,
  1306.                                             'generator_id' => $v,
  1307.                                             'priority' => 0,
  1308.                                         ];
  1309.                                     })
  1310.                                 ->end()
  1311.                                 ->addDefaultsIfNotSet()
  1312.                                 ->canBeDisabled()
  1313.                                 ->children()
  1314.                                     ->scalarNode('generator_id')
  1315.                                         ->cannotBeEmpty()
  1316.                                     ->end()
  1317.                                     ->integerNode('priority')
  1318.                                         ->defaultValue(0)
  1319.                                     ->end()
  1320.                                 ->end()
  1321.                             ->end()
  1322.                         ->end()
  1323.                     ->end()
  1324.                 ->end()
  1325.             ->end()
  1326.         ->end();
  1327.     }
  1328.     private function addMimeNode(ArrayNodeDefinition $rootNode)
  1329.     {
  1330.         $rootNode
  1331.             ->children()
  1332.                 ->arrayNode('mime')
  1333.                     ->addDefaultsIfNotSet()
  1334.                     ->children()
  1335.                         ->arrayNode('extensions')
  1336.                             ->useAttributeAsKey('name')
  1337.                             ->prototype('scalar')
  1338.                         ->end()
  1339.                     ->end()
  1340.                 ->end()
  1341.             ->end()
  1342.         ->end();
  1343.     }
  1344.     private function addWorkflowNode(ArrayNodeDefinition $rootNode)
  1345.     {
  1346.         $rootNode
  1347.             ->children()
  1348.                  ->arrayNode('workflows')
  1349.                         ->useAttributeAsKey('name')
  1350.                         ->prototype('array')
  1351.                             ->children()
  1352.                                 ->arrayNode('placeholders')
  1353.                                     ->info('Placeholder values in this workflow configuration (locale: "%%locale%%") will be replaced by the given placeholder value (eg. "de_AT")')
  1354.                                     ->example([
  1355.                                         'placeholders' => [
  1356.                                             '%%locale%%' => 'de_AT',
  1357.                                         ],
  1358.                                     ])
  1359.                                     ->defaultValue([])
  1360.                                     ->beforeNormalization()
  1361.                                         ->castToArray()
  1362.                                         ->always()
  1363.                                         ->then(function ($placeholders) {
  1364.                                             $this->placeholders $placeholders;
  1365.                                             return $placeholders;
  1366.                                         })
  1367.                                     ->end()
  1368.                                     ->prototype('scalar')->end()
  1369.                                 ->end()
  1370.                                 ->booleanNode('enabled')
  1371.                                     ->defaultTrue()
  1372.                                     ->info('Can be used to enable or disable the workflow.')
  1373.                                 ->end()
  1374.                                 ->integerNode('priority')
  1375.                                     ->defaultValue(0)
  1376.                                     ->info('When multiple custom view or permission settings from different places in different workflows are valid, the workflow with the highest priority will be used.')
  1377.                                 ->end()
  1378.                                 ->scalarNode('label')
  1379.                                     ->info('Will be used in the backend interface as nice name for the workflow. If not set the technical workflow name will be used as label too.')
  1380.                                 ->end()
  1381.                                 ->arrayNode('audit_trail')
  1382.                                     ->canBeEnabled()
  1383.                                     ->info('Enable default audit trail feature provided by Symfony. Take a look at the Symfony docs for more details.')
  1384.                                 ->end()
  1385.                                 ->enumNode('type')
  1386.                                     ->values(['workflow''state_machine'])
  1387.                                     ->info('A workflow with type "workflow" can handle multiple places at one time whereas a state_machine provides a finite state_machine (only one place at one time). Take a look at the Symfony docs for more details.')
  1388.                                 ->end()
  1389.                                 ->arrayNode('marking_store')
  1390.                                     ->fixXmlConfig('argument')
  1391.                                     ->children()
  1392.                                         ->enumNode('type')
  1393.                                             ->values(['multiple_state''single_state''state_table''data_object_multiple_state''data_object_splitted_state'])
  1394.                                         ->end()
  1395.                                         ->arrayNode('arguments')
  1396.                                             ->beforeNormalization()
  1397.                                                 ->always()
  1398.                                                 ->then(function ($arguments) {
  1399.                                                     if (is_string($arguments)) {
  1400.                                                         $arguments = [$arguments];
  1401.                                                     }
  1402.                                                     if (!empty($this->placeholders)) {
  1403.                                                         $arguments $this->placeholderProcessor->mergePlaceholders($arguments$this->placeholders);
  1404.                                                     }
  1405.                                                     return $arguments;
  1406.                                                 })
  1407.                                             ->end()
  1408.                                             ->requiresAtLeastOneElement()
  1409.                                             ->prototype('variable')
  1410.                                             ->end()
  1411.                                         ->end()
  1412.                                         ->scalarNode('service')
  1413.                                             ->cannotBeEmpty()
  1414.                                         ->end()
  1415.                                     ->end()
  1416.                                     ->info('Handles the way how the state/place is stored. If not defined "state_table" will be used as default. Take a look at @TODO for a description of the different types.')
  1417.                                     ->validate()
  1418.                                         ->ifTrue(function ($v) {
  1419.                                             return isset($v['type']) && isset($v['service']);
  1420.                                         })
  1421.                                         ->thenInvalid('"type" and "service" cannot be used together.')
  1422.                                     ->end()
  1423.                                     ->validate()
  1424.                                         ->ifTrue(function ($v) {
  1425.                                             return !empty($v['arguments']) && isset($v['service']);
  1426.                                         })
  1427.                                         ->thenInvalid('"arguments" and "service" cannot be used together.')
  1428.                                     ->end()
  1429.                                 ->end()
  1430.                                 ->arrayNode('supports')
  1431.                                     ->beforeNormalization()
  1432.                                         ->ifString()
  1433.                                         ->then(function ($v) {
  1434.                                             return [$v];
  1435.                                         })
  1436.                                     ->end()
  1437.                                     ->prototype('scalar')
  1438.                                         ->cannotBeEmpty()
  1439.                                     ->end()
  1440.                                     ->info('List of supported entity classes. Take a look at the Symfony docs for more details.')
  1441.                                     ->example(['\Pimcore\Model\DataObject\Product'])
  1442.                                 ->end()
  1443.                                 ->arrayNode('support_strategy')
  1444.                                     ->fixXmlConfig('argument')
  1445.                                     ->children()
  1446.                                         ->enumNode('type')
  1447.                                             ->values(['expression'])
  1448.                                             ->info('Type "expression": a symfony expression to define a criteria.')
  1449.                                         ->end()
  1450.                                         ->arrayNode('arguments')
  1451.                                             ->beforeNormalization()
  1452.                                                 ->ifString()
  1453.                                                 ->then(function ($v) {
  1454.                                                     return [$v];
  1455.                                                 })
  1456.                                             ->end()
  1457.                                             ->requiresAtLeastOneElement()
  1458.                                             ->prototype('variable')
  1459.                                             ->end()
  1460.                                         ->end()
  1461.                                         ->scalarNode('service')
  1462.                                             ->cannotBeEmpty()
  1463.                                             ->info('Define a custom service to handle the logic. Take a look at the Symfony docs for more details.')
  1464.                                         ->end()
  1465.                                     ->end()
  1466.                                     ->validate()
  1467.                                         ->ifTrue(function ($v) {
  1468.                                             return isset($v['type']) && isset($v['service']);
  1469.                                         })
  1470.                                         ->thenInvalid('"type" and "service" cannot be used together.')
  1471.                                     ->end()
  1472.                                     ->validate()
  1473.                                         ->ifTrue(function ($v) {
  1474.                                             return !empty($v['arguments']) && isset($v['service']);
  1475.                                         })
  1476.                                         ->thenInvalid('"arguments" and "service" cannot be used together.')
  1477.                                     ->end()
  1478.                                     ->info('Can be used to implement a special logic which subjects are supported by the workflow. For example only products matching certain criteria.')
  1479.                                     ->example([
  1480.                                         'type' => 'expression',
  1481.                                         'arguments' => [
  1482.                                             '\Pimcore\Model\DataObject\Product',
  1483.                                             'subject.getProductType() == "article" and is_fully_authenticated() and "ROLE_PIMCORE_ADMIN" in roles',
  1484.                                         ],
  1485.                                     ])
  1486.                                 ->end()
  1487.                                 ->scalarNode('initial_place')
  1488.                                     ->defaultNull()
  1489.                                     ->setDeprecated('The "%node%" option is deprecated. Use "initial_markings" instead.')
  1490.                                     ->info('Will be applied when the current place is empty.')
  1491.                                 ->end()
  1492.                                 ->arrayNode('initial_markings')
  1493.                                     ->info('Can be used to set the initial places (markings) for a workflow. Note that this option is Symfony 4.3+ only')
  1494.                                     ->beforeNormalization()
  1495.                                         ->ifString()
  1496.                                             ->then(function ($v) {
  1497.                                                 return [$v];
  1498.                                             })
  1499.                                         ->end()
  1500.                                         ->requiresAtLeastOneElement()
  1501.                                         ->prototype('scalar')
  1502.                                         ->cannotBeEmpty()
  1503.                                     ->end()
  1504.                                 ->end()
  1505.                                 ->arrayNode('places')
  1506.                                     ->prototype('array')
  1507.                                         ->children()
  1508.                                             ->scalarNode('label')->info('Nice name which will be used in the Pimcore backend.')->end()
  1509.                                             ->scalarNode('title')->info('Title/tooltip for this place when it is displayed in the header of the Pimcore element detail view in the backend.')->defaultValue('')->end()
  1510.                                             ->scalarNode('color')->info('Color of the place which will be used in the Pimcore backend.')->defaultValue('#bfdadc')->end()
  1511.                                             ->booleanNode('colorInverted')->info('If set to true the color will be used as border and font color otherwise as background color.')->defaultFalse()->end()
  1512.                                             ->booleanNode('visibleInHeader')->info('If set to false, the place will be hidden in the header of the Pimcore element detail view in the backend.')->defaultTrue()->end()
  1513.                                             ->arrayNode('permissions')
  1514.                                                 ->prototype('array')
  1515.                                                     ->children()
  1516.                                                         ->scalarNode('condition')->info('A symfony expression can be configured here. The first set of permissions which are matching the condition will be used.')->end()
  1517.                                                         ->booleanNode('save')->info('save permission as it can be configured in Pimcore workplaces')->end()
  1518.                                                         ->booleanNode('publish')->info('publish permission as it can be configured in Pimcore workplaces')->end()
  1519.                                                         ->booleanNode('unpublish')->info('unpublish permission as it can be configured in Pimcore workplaces')->end()
  1520.                                                         ->booleanNode('delete')->info('delete permission as it can be configured in Pimcore workplaces')->end()
  1521.                                                         ->booleanNode('rename')->info('rename permission as it can be configured in Pimcore workplaces')->end()
  1522.                                                         ->booleanNode('view')->info('view permission as it can be configured in Pimcore workplaces')->end()
  1523.                                                         ->booleanNode('settings')->info('settings permission as it can be configured in Pimcore workplaces')->end()
  1524.                                                         ->booleanNode('versions')->info('versions permission as it can be configured in Pimcore workplaces')->end()
  1525.                                                         ->booleanNode('properties')->info('properties permission as it can be configured in Pimcore workplaces')->end()
  1526.                                                         ->booleanNode('modify')->info('a short hand for save, publish, unpublish, delete + rename')->end()
  1527.                                                         ->scalarNode('objectLayout')->info('if set, the user will see the configured custom data object layout')->end()
  1528.                                                     ->end()
  1529.                                                 ->end()
  1530.                                             ->end()
  1531.                                         ->end()
  1532.                                     ->end()
  1533.                                     ->beforeNormalization()
  1534.                                         ->always()
  1535.                                         ->then(function ($places) {
  1536.                                             if (!empty($this->placeholders)) {
  1537.                                                 foreach ($places as $name => $place) {
  1538.                                                     $places[$name] = $this->placeholderProcessor->mergePlaceholders($place$this->placeholders);
  1539.                                                 }
  1540.                                             }
  1541.                                             return $places;
  1542.                                         })
  1543.                                     ->end()
  1544.                                     ->example([
  1545.                                         'places' => [
  1546.                                             'closed' => [
  1547.                                                 'label' => 'close product',
  1548.                                                 'permissions' => [
  1549.                                                     [
  1550.                                                         'condition' => "is_fully_authenticated() and 'ROLE_PIMCORE_ADMIN' in roles",
  1551.                                                         'modify' => false,
  1552.                                                     ],
  1553.                                                     [
  1554.                                                         'modify' => false,
  1555.                                                         'objectLayout' => 2,
  1556.                                                     ],
  1557.                                                 ],
  1558.                                             ],
  1559.                                         ],
  1560.                                     ])
  1561.                                 ->end()
  1562.                                 ->arrayNode('transitions')
  1563.                                     ->beforeNormalization()
  1564.                                         ->always()
  1565.                                         ->then(function ($transitions) {
  1566.                                             // It's an indexed array, we let the validation occurs
  1567.                                             if (isset($transitions[0])) {
  1568.                                                 return $transitions;
  1569.                                             }
  1570.                                             foreach ($transitions as $name => $transition) {
  1571.                                                 if (array_key_exists('name', (array) $transition)) {
  1572.                                                     continue;
  1573.                                                 }
  1574.                                                 $transition['name'] = $name;
  1575.                                                 $transitions[$name] = $transition;
  1576.                                             }
  1577.                                             return $transitions;
  1578.                                         })
  1579.                                     ->end()
  1580.                                     ->isRequired()
  1581.                                     ->requiresAtLeastOneElement()
  1582.                                     ->prototype('array')
  1583.                                         ->children()
  1584.                                             ->scalarNode('name')
  1585.                                                 ->isRequired()
  1586.                                                 ->cannotBeEmpty()
  1587.                                             ->end()
  1588.                                             ->scalarNode('guard')
  1589.                                                 ->cannotBeEmpty()
  1590.                                                 ->info('An expression to block the transition')
  1591.                                                 ->example('is_fully_authenticated() and has_role(\'ROLE_JOURNALIST\') and subject.getTitle() == \'My first article\'')
  1592.                                             ->end()
  1593.                                             ->arrayNode('from')
  1594.                                                 ->beforeNormalization()
  1595.                                                     ->ifString()
  1596.                                                     ->then(function ($v) {
  1597.                                                         return [$v];
  1598.                                                     })
  1599.                                                 ->end()
  1600.                                                 ->requiresAtLeastOneElement()
  1601.                                                 ->prototype('scalar')
  1602.                                                     ->cannotBeEmpty()
  1603.                                                 ->end()
  1604.                                             ->end()
  1605.                                             ->arrayNode('to')
  1606.                                                 ->beforeNormalization()
  1607.                                                     ->ifString()
  1608.                                                     ->then(function ($v) {
  1609.                                                         return [$v];
  1610.                                                     })
  1611.                                                 ->end()
  1612.                                                 ->requiresAtLeastOneElement()
  1613.                                                 ->prototype('scalar')
  1614.                                                     ->cannotBeEmpty()
  1615.                                                 ->end()
  1616.                                             ->end()
  1617.                                             ->arrayNode('options')
  1618.                                                 ->children()
  1619.                                                     ->scalarNode('label')->info('Nice name for the Pimcore backend.')->end()
  1620.                                                     ->arrayNode('notes')
  1621.                                                         ->children()
  1622.                                                             ->booleanNode('commentEnabled')->defaultFalse()->info('If enabled a detail window will open when the user executes the transition. In this detail view the user be asked to enter a "comment". This comment then will be used as comment for the notes/events feature.')->end()
  1623.                                                             ->booleanNode('commentRequired')->defaultFalse()->info('Set this to true if the comment should be a required field.')->end()
  1624.                                                             ->scalarNode('commentSetterFn')->info('Can be used for data objects. The comment will be saved to the data object additionally to the notes/events through this setter function.')->end()
  1625.                                                             ->scalarNode('commentGetterFn')->info('Can be used for data objects to prefill the comment field with data from the data object.')->end()
  1626.                                                             ->scalarNode('type')->defaultValue('Status update')->info('Set\'s the type string in the saved note.')->end()
  1627.                                                             ->scalarNode('title')->info('An optional alternative "title" for the note, if blank the actions transition result is used.')->end()
  1628.                                                             ->arrayNode('additionalFields')
  1629.                                                                 ->prototype('array')
  1630.                                                                     ->children()
  1631.                                                                         ->scalarNode('name')->isRequired()->info('The technical name used in the input form.')->end()
  1632.                                                                         ->enumNode('fieldType')
  1633.                                                                             ->isRequired()
  1634.                                                                             ->values(['input''textarea''select''datetime''date''user''checkbox'])
  1635.                                                                             ->info('The data component name/field type.')
  1636.                                                                         ->end()
  1637.                                                                         ->scalarNode('title')->info('The label used by the field')->end()
  1638.                                                                         ->booleanNode('required')->defaultFalse()->info('Whether or not the field is required.')->end()
  1639.                                                                         ->scalarNode('setterFn')->info('Optional setter function (available in the element, for example in the updated object), if not specified, data will be added to notes. The Workflow manager will call the function with the whole field data.')->end()
  1640.                                                                         ->arrayNode('fieldTypeSettings')
  1641.                                                                              ->prototype('variable')->end()
  1642.                                                                              ->info('Will be passed to the underlying Pimcore data object field type. Can be used to configure the options of a select box for example.')
  1643.                                                                         ->end()
  1644.                                                                     ->end()
  1645.                                                                 ->end()
  1646.                                                                 ->info('Add additional field to the transition detail window.')
  1647.                                                             ->end()
  1648.                                                         ->end()
  1649.                                                     ->end()
  1650.                                                     ->scalarNode('iconClass')->info('Css class to define the icon which will be used in the actions button in the backend.')->end()
  1651.                                                     ->scalarNode('objectLayout')->defaultValue(false)->info('Forces an object layout after the transition was performed. This objectLayout setting overrules all objectLayout settings within the places configs.')->end()
  1652.                                                     ->arrayNode('notificationSettings')
  1653.                                                         ->prototype('array')
  1654.                                                             ->children()
  1655.                                                                 ->scalarNode('condition')->info('A symfony expression can be configured here. All sets of notification which are matching the condition will be used.')->end()
  1656.                                                                 ->arrayNode('notifyUsers')
  1657.                                                                     ->prototype('scalar')
  1658.                                                                         ->cannotBeEmpty()
  1659.                                                                     ->end()
  1660.                                                                     ->info('Send an email notification to a list of users (user names) when the transition get\'s applied')
  1661.                                                                 ->end()
  1662.                                                                 ->arrayNode('notifyRoles')
  1663.                                                                     ->prototype('scalar')
  1664.                                                                         ->cannotBeEmpty()
  1665.                                                                     ->end()
  1666.                                                                     ->info('Send an email notification to a list of user roles (role names) when the transition get\'s applied')
  1667.                                                                 ->end()
  1668.                                                                 ->arrayNode('channelType')
  1669.                                                                     ->requiresAtLeastOneElement()
  1670.                                                                     ->enumPrototype()
  1671.                                                                         ->values([NotificationSubscriber::NOTIFICATION_CHANNEL_MAILNotificationSubscriber::NOTIFICATION_CHANNEL_PIMCORE_NOTIFICATION])
  1672.                                                                         ->cannotBeEmpty()
  1673.                                                                         ->defaultValue(NotificationSubscriber::NOTIFICATION_CHANNEL_MAIL)
  1674.                                                                     ->end()
  1675.                                                                     ->info('Define which channel notification should be sent to, possible values "' NotificationSubscriber::NOTIFICATION_CHANNEL_MAIL '" and "' NotificationSubscriber::NOTIFICATION_CHANNEL_PIMCORE_NOTIFICATION '", default value is "' NotificationSubscriber::NOTIFICATION_CHANNEL_MAIL '".')
  1676.                                                                     ->addDefaultChildrenIfNoneSet()
  1677.                                                                 ->end()
  1678.                                                                 ->enumNode('mailType')
  1679.                                                                     ->values([NotificationSubscriber::MAIL_TYPE_TEMPLATENotificationSubscriber::MAIL_TYPE_DOCUMENT])
  1680.                                                                     ->defaultValue(NotificationSubscriber::MAIL_TYPE_TEMPLATE)
  1681.                                                                     ->info('Type of mail source.')
  1682.                                                                 ->end()
  1683.                                                                 ->scalarNode('mailPath')
  1684.                                                                     ->defaultValue(NotificationSubscriber::DEFAULT_MAIL_TEMPLATE_PATH)
  1685.                                                                     ->info('Path to mail source - either Symfony path to template or fullpath to Pimcore document. Optional use ' NotificationEmailService::MAIL_PATH_LANGUAGE_PLACEHOLDER ' as placeholder for language.')
  1686.                                                                 ->end()
  1687.                                                             ->end()
  1688.                                                         ->end()
  1689.                                                     ->end()
  1690.                                                     ->enumNode('changePublishedState')
  1691.                                                         ->values([ChangePublishedStateSubscriber::NO_CHANGEChangePublishedStateSubscriber::FORCE_UNPUBLISHEDChangePublishedStateSubscriber::FORCE_PUBLISHEDChangePublishedStateSubscriber::SAVE_VERSION])
  1692.                                                         ->defaultValue(ChangePublishedStateSubscriber::NO_CHANGE)
  1693.                                                         ->info('Change published state of element while transition (only available for documents and data objects).')
  1694.                                                     ->end()
  1695.                                                 ->end()
  1696.                                             ->end()
  1697.                                         ->end()
  1698.                                     ->end()
  1699.                                     ->example([
  1700.                                         'close_product' => [
  1701.                                             'from' => 'open',
  1702.                                             'to' => 'closed',
  1703.                                             'options' => [
  1704.                                                 'label' => 'close product',
  1705.                                                 'notes' => [
  1706.                                                     'commentEnabled' => true,
  1707.                                                     'commentRequired' => true,
  1708.                                                     'additionalFields' => [
  1709.                                                         [
  1710.                                                             'name' => 'accept',
  1711.                                                             'title' => 'accept terms',
  1712.                                                             'required' => true,
  1713.                                                             'fieldType' => 'checkbox',
  1714.                                                         ],
  1715.                                                         [
  1716.                                                             'name' => 'select',
  1717.                                                             'title' => 'please select a type',
  1718.                                                             'setterFn' => 'setSpecialWorkflowType',
  1719.                                                             'fieldType' => 'select',
  1720.                                                             'fieldTypeSettings' => [
  1721.                                                                 'options' => [
  1722.                                                                     ['key' => 'Option A''value' => 'a'],
  1723.                                                                     ['key' => 'Option B''value' => 'b'],
  1724.                                                                     ['key' => 'Option C''value' => 'c'],
  1725.                                                                 ],
  1726.                                                             ],
  1727.                                                         ],
  1728.                                                     ],
  1729.                                                 ],
  1730.                                             ],
  1731.                                         ],
  1732.                                     ])
  1733.                                 ->end()
  1734.                                 ->arrayNode('globalActions')
  1735.                                     ->prototype('array')
  1736.                                         ->children()
  1737.                                             ->scalarNode('label')->info('Nice name for the Pimcore backend.')->end()
  1738.                                             ->scalarNode('iconClass')->info('Css class to define the icon which will be used in the actions button in the backend.')->end()
  1739.                                             ->scalarNode('objectLayout')->defaultValue(false)->info('Forces an object layout after the global action was performed. This objectLayout setting overrules all objectLayout settings within the places configs.')->end()
  1740.                                             ->scalarNode('guard')
  1741.                                                 ->cannotBeEmpty()
  1742.                                                 ->info('An expression to block the action')
  1743.                                                 ->example('is_fully_authenticated() and has_role(\'ROLE_JOURNALIST\') and subject.getTitle() == \'My first article\'')
  1744.                                             ->end()
  1745.                                             ->arrayNode('to')
  1746.                                                 ->beforeNormalization()
  1747.                                                     ->ifString()
  1748.                                                     ->then(function ($v) {
  1749.                                                         return [$v];
  1750.                                                     })
  1751.                                                 ->end()
  1752.                                                 ->requiresAtLeastOneElement()
  1753.                                                 ->prototype('scalar')
  1754.                                                     ->cannotBeEmpty()
  1755.                                                 ->end()
  1756.                                                 ->info('Optionally set the current place of the workflow. Can be used for example to reset the workflow to the initial place.')
  1757.                                             ->end()
  1758.                                             ->arrayNode('notes')
  1759.                                                 ->children()
  1760.                                                     ->booleanNode('commentEnabled')->defaultFalse()->end()
  1761.                                                     ->booleanNode('commentRequired')->defaultFalse()->end()
  1762.                                                     ->scalarNode('commentSetterFn')->end()
  1763.                                                     ->scalarNode('commentGetterFn')->end()
  1764.                                                     ->scalarNode('type')->defaultValue('Status update')->end()
  1765.                                                     ->scalarNode('title')->end()
  1766.                                                     ->arrayNode('additionalFields')
  1767.                                                         ->prototype('array')
  1768.                                                             ->children()
  1769.                                                                 ->scalarNode('name')->isRequired()->end()
  1770.                                                                 ->enumNode('fieldType')
  1771.                                                                     ->isRequired()
  1772.                                                                     ->values(['input''textarea''select''datetime''date''user''checkbox'])
  1773.                                                                 ->end()
  1774.                                                                 ->scalarNode('title')->end()
  1775.                                                                 ->booleanNode('required')->defaultFalse()->end()
  1776.                                                                 ->scalarNode('setterFn')->end()
  1777.                                                                 ->arrayNode('fieldTypeSettings')
  1778.                                                                      ->prototype('variable')->end()
  1779.                                                                 ->end()
  1780.                                                             ->end()
  1781.                                                         ->end()
  1782.                                                     ->end()
  1783.                                                 ->end()
  1784.                                                 ->info('See notes section of transitions. It works exactly the same way.')
  1785.                                             ->end()
  1786.                                         ->end()
  1787.                                     ->end()
  1788.                                     ->info('Actions which will be added to actions button independently of the current workflow place.')
  1789.                                 ->end()
  1790.                             ->end()
  1791.                             ->validate()
  1792.                                 ->ifTrue(function ($v) {
  1793.                                     return $v['supports'] && isset($v['support_strategy']);
  1794.                                 })
  1795.                                 ->thenInvalid('"supports" and "support_strategy" cannot be used together.')
  1796.                             ->end()
  1797.                             ->validate()
  1798.                                 ->ifTrue(function ($v) {
  1799.                                     return !$v['supports'] && !isset($v['support_strategy']);
  1800.                                 })
  1801.                                 ->thenInvalid('"supports" or "support_strategy" should be configured.')
  1802.                             ->end()
  1803.                         ->end()
  1804.                     ->end()
  1805.                 ->end()
  1806.                 ->addDefaultsIfNotSet()
  1807.             ->end();
  1808.     }
  1809. }