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

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 Commercial License (PCL)
  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 PCL
  13.  */
  14. namespace Pimcore\Bundle\CoreBundle\DependencyInjection;
  15. use Pimcore\Bundle\CoreBundle\DependencyInjection\Config\Processor\PlaceholderProcessor;
  16. use Pimcore\Targeting\Storage\CookieStorage;
  17. use Pimcore\Targeting\Storage\TargetingStorageInterface;
  18. use Pimcore\Workflow\EventSubscriber\ChangePublishedStateSubscriber;
  19. use Pimcore\Workflow\EventSubscriber\NotificationSubscriber;
  20. use Pimcore\Workflow\Notification\NotificationEmailService;
  21. use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
  22. use Symfony\Component\Config\Definition\Builder\NodeDefinition;
  23. use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  24. use Symfony\Component\Config\Definition\ConfigurationInterface;
  25. /**
  26.  * @internal
  27.  */
  28. final class Configuration implements ConfigurationInterface
  29. {
  30.     /**
  31.      * @var PlaceholderProcessor
  32.      */
  33.     private $placeholderProcessor;
  34.     private $placeholders = [];
  35.     public function __construct()
  36.     {
  37.         $this->placeholderProcessor = new PlaceholderProcessor();
  38.         $this->placeholders = [];
  39.     }
  40.     /**
  41.      * Generates the configuration tree builder.
  42.      *
  43.      * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder
  44.      */
  45.     public function getConfigTreeBuilder()
  46.     {
  47.         $treeBuilder = new TreeBuilder('pimcore');
  48.         /** @var ArrayNodeDefinition $rootNode */
  49.         $rootNode $treeBuilder->getRootNode();
  50.         $rootNode->addDefaultsIfNotSet();
  51.         $rootNode
  52.             ->children()
  53.                 ->arrayNode('error_handling')
  54.                     ->addDefaultsIfNotSet()
  55.                     ->children()
  56.                         ->booleanNode('render_error_document')
  57.                             ->info('Render error document in case of an error instead of showing Symfony\'s error page')
  58.                             ->defaultTrue()
  59.                             ->beforeNormalization()
  60.                                 ->ifString()
  61.                                 ->then(function ($v) {
  62.                                     return (bool)$v;
  63.                                 })
  64.                             ->end()
  65.                         ->end()
  66.                     ->end()
  67.                     ->setDeprecated(
  68.                         'pimcore/pimcore',
  69.                         '10.1',
  70.                         'The "%node%" option is deprecated since Pimcore 10.1, it will be removed in Pimcore 11.'
  71.                     )
  72.                 ->end()
  73.                 ->arrayNode('bundles')
  74.                     ->addDefaultsIfNotSet()
  75.                     ->children()
  76.                         ->arrayNode('search_paths')
  77.                             ->prototype('scalar')->end()
  78.                         ->end()
  79.                         ->booleanNode('handle_composer')
  80.                             ->defaultTrue()
  81.                         ->end()
  82.                     ->end()
  83.                 ->end()
  84.                 ->arrayNode('flags')
  85.                     ->info('Generic map for feature flags')
  86.                     ->prototype('scalar')->end()
  87.                 ->end()
  88.                 ->arrayNode('translations')
  89.                     ->addDefaultsIfNotSet()
  90.                     ->children()
  91.                         ->arrayNode('admin_translation_mapping')
  92.                             ->useAttributeAsKey('locale')
  93.                             ->prototype('scalar')->end()
  94.                         ->end()
  95.                         ->arrayNode('debugging')
  96.                             ->info('If debugging is enabled, the translator will return the plain translation key instead of the translated message.')
  97.                             ->addDefaultsIfNotSet()
  98.                             ->canBeDisabled()
  99.                             ->children()
  100.                                 ->scalarNode('parameter')
  101.                                     ->defaultValue('pimcore_debug_translations')
  102.                                 ->end()
  103.                             ->end()
  104.                         ->end()
  105.                         ->arrayNode('data_object')
  106.                             ->addDefaultsIfNotSet()
  107.                             ->children()
  108.                                 ->arrayNode('translation_extractor')
  109.                                     ->children()
  110.                                         ->arrayNode('attributes')
  111.                                             ->info('Can be used to restrict the extracted localized fields (e.g. used by XLIFF exporter in the Pimcore backend)')
  112.                                             ->prototype('array')
  113.                                                 ->prototype('scalar')->end()
  114.                                             ->end()
  115.                                             ->example(
  116.                                                 [
  117.                                                     'Product' => ['name''description'],
  118.                                                     'Brand' => ['name'],
  119.                                                 ]
  120.                                             )
  121.                                         ->end()
  122.                                     ->end()
  123.                                 ->end()
  124.                             ->end()
  125.                         ->end()
  126.                     ->end()
  127.                 ->end()
  128.                 ->arrayNode('maps')
  129.                     ->addDefaultsIfNotSet()
  130.                     ->children()
  131.                         ->scalarNode('tile_layer_url_template')
  132.                             ->defaultValue('https://a.tile.openstreetmap.org/{z}/{x}/{y}.png')
  133.                         ->end()
  134.                         ->scalarNode('geocoding_url_template')
  135.                             ->defaultValue('https://nominatim.openstreetmap.org/search?q={q}&addressdetails=1&format=json&limit=1')
  136.                         ->end()
  137.                         ->scalarNode('reverse_geocoding_url_template')
  138.                             ->defaultValue('https://nominatim.openstreetmap.org/reverse?format=json&lat={lat}&lon={lon}&addressdetails=1')
  139.                         ->end()
  140.                     ->end()
  141.                 ->end()
  142.             ->end();
  143.         $this->addGeneralNode($rootNode);
  144.         $this->addMaintenanceNode($rootNode);
  145.         $this->addServicesNode($rootNode);
  146.         $this->addObjectsNode($rootNode);
  147.         $this->addAssetNode($rootNode);
  148.         $this->addDocumentsNode($rootNode);
  149.         $this->addEncryptionNode($rootNode);
  150.         $this->addModelsNode($rootNode);
  151.         $this->addRoutingNode($rootNode);
  152.         $this->addCacheNode($rootNode);
  153.         $this->addContextNode($rootNode);
  154.         $this->addAdminNode($rootNode);
  155.         $this->addWebProfilerNode($rootNode);
  156.         $this->addSecurityNode($rootNode);
  157.         $this->addEmailNode($rootNode);
  158.         $this->addNewsletterNode($rootNode);
  159.         $this->addCustomReportsNode($rootNode);
  160.         $this->addTargetingNode($rootNode);
  161.         $this->addSitemapsNode($rootNode);
  162.         $this->addWorkflowNode($rootNode);
  163.         $this->addHttpClientNode($rootNode);
  164.         $this->addApplicationLogNode($rootNode);
  165.         $this->addPredefinedPropertiesNode($rootNode);
  166.         $this->addStaticRoutesNode($rootNode);
  167.         $this->addPerspectivesNode($rootNode);
  168.         $this->addCustomViewsNode($rootNode);
  169.         return $treeBuilder;
  170.     }
  171.     /**
  172.      * Add maintenance config
  173.      *
  174.      * @param ArrayNodeDefinition $rootNode
  175.      */
  176.     private function addMaintenanceNode(ArrayNodeDefinition $rootNode)
  177.     {
  178.         $rootNode
  179.             ->children()
  180.             ->arrayNode('maintenance')
  181.             ->addDefaultsIfNotSet()
  182.             ->children()
  183.                 ->arrayNode('housekeeping')
  184.                 ->addDefaultsIfNotSet()
  185.                 ->children()
  186.                     ->integerNode('cleanup_tmp_files_atime_older_than')
  187.                         ->defaultValue(7776000// 90 days
  188.                     ->end()
  189.                     ->integerNode('cleanup_profiler_files_atime_older_than')
  190.                         ->defaultValue(1800)
  191.                     ->end()
  192.         ;
  193.     }
  194.     /**
  195.      * Add general config
  196.      *
  197.      * @param ArrayNodeDefinition $rootNode
  198.      */
  199.     private function addGeneralNode(ArrayNodeDefinition $rootNode)
  200.     {
  201.         $rootNode
  202.             ->children()
  203.             ->arrayNode('general')
  204.             ->addDefaultsIfNotSet()
  205.             ->children()
  206.                 ->scalarNode('timezone')
  207.                     ->defaultValue('')
  208.                 ->end()
  209.                 ->scalarNode('path_variable')
  210.                     ->info('Additional $PATH variable (: separated) (/x/y:/foo/bar):')
  211.                     ->defaultNull()
  212.                 ->end()
  213.                 ->scalarNode('domain')
  214.                     ->defaultValue('')
  215.                 ->end()
  216.                 ->booleanNode('redirect_to_maindomain')
  217.                     ->beforeNormalization()
  218.                         ->ifString()
  219.                         ->then(function ($v) {
  220.                             return (bool)$v;
  221.                         })
  222.                     ->end()
  223.                     ->defaultFalse()
  224.                 ->end()
  225.                 ->scalarNode('language')
  226.                     ->defaultValue('en')
  227.                 ->end()
  228.                 ->scalarNode('valid_languages')
  229.                     ->defaultValue('en')
  230.                 ->end()
  231.                 ->arrayNode('fallback_languages')
  232.                     ->performNoDeepMerging()
  233.                     ->beforeNormalization()
  234.                     ->ifArray()
  235.                         ->then(function ($v) {
  236.                             return $v;
  237.                         })
  238.                     ->end()
  239.                     ->prototype('scalar')
  240.                     ->end()
  241.                 ->end()
  242.                 ->scalarNode('default_language')
  243.                     ->defaultValue('en')
  244.                 ->end()
  245.                 ->booleanNode('disable_usage_statistics')
  246.                     ->beforeNormalization()
  247.                         ->ifString()
  248.                         ->then(function ($v) {
  249.                             return (bool)$v;
  250.                         })
  251.                     ->end()
  252.                     ->defaultFalse()
  253.                 ->end()
  254.                 ->booleanNode('debug_admin_translations')
  255.                     ->info('Debug Admin-Translations (displayed wrapped in +)')
  256.                     ->beforeNormalization()
  257.                         ->ifString()
  258.                         ->then(function ($v) {
  259.                             return (bool)$v;
  260.                         })
  261.                     ->end()
  262.                     ->defaultFalse()
  263.                 ->end()
  264.                 ->scalarNode('instance_identifier')
  265.                     ->defaultNull()
  266.                     ->info('UUID instance identifier. Has to be unique throughout multiple Pimcore instances. UUID generation will be automatically enabled if a Instance identifier is provided (do not change the instance identifier afterwards - this will cause invalid UUIDs)')
  267.                     ->end()
  268.                 ->end()
  269.             ->end();
  270.     }
  271.     /**
  272.      * @param ArrayNodeDefinition $rootNode
  273.      */
  274.     private function addServicesNode(ArrayNodeDefinition $rootNode)
  275.     {
  276.         $rootNode
  277.             ->children()
  278.             ->arrayNode('services')
  279.                 ->addDefaultsIfNotSet()
  280.                 ->children()
  281.                     ->arrayNode('google')
  282.                     ->addDefaultsIfNotSet()
  283.                     ->children()
  284.                         ->scalarNode('client_id')
  285.                             ->info('This is required for the Google API integrations. Only use a `Service Account´ from the Google Cloud Console.')
  286.                             ->defaultNull()
  287.                         ->end()
  288.                         ->scalarNode('email')
  289.                             ->info('Email address of the Google service account')
  290.                             ->defaultNull()
  291.                         ->end()
  292.                         ->scalarNode('simple_api_key')
  293.                             ->info('Server API key')
  294.                             ->defaultNull()
  295.                         ->end()
  296.                         ->scalarNode('browser_api_key')
  297.                             ->info('Browser API key')
  298.                             ->defaultNull()
  299.                         ->end()
  300.                     ->end()
  301.                     ->end()
  302.                 ->end()
  303.             ->end();
  304.     }
  305.     /**
  306.      * @param ArrayNodeDefinition $rootNode
  307.      */
  308.     private function addModelsNode(ArrayNodeDefinition $rootNode)
  309.     {
  310.         $rootNode
  311.             ->children()
  312.                 ->arrayNode('models')
  313.                     ->addDefaultsIfNotSet()
  314.                     ->children()
  315.                         ->arrayNode('class_overrides')
  316.                             ->useAttributeAsKey('name')
  317.                             ->prototype('scalar');
  318.     }
  319.     /**
  320.      * @param ArrayNodeDefinition $rootNode
  321.      */
  322.     private function addHttpClientNode(ArrayNodeDefinition $rootNode)
  323.     {
  324.         $rootNode
  325.             ->children()
  326.                 ->arrayNode('httpclient')
  327.                 ->addDefaultsIfNotSet()
  328.                     ->children()
  329.                         ->scalarNode('adapter')
  330.                             ->info('Set to `Proxy` if proxy server should be used')
  331.                             ->defaultValue('Socket')
  332.                         ->end()
  333.                         ->scalarNode('proxy_host')
  334.                             ->defaultNull()
  335.                         ->end()
  336.                         ->scalarNode('proxy_port')
  337.                             ->defaultNull()
  338.                         ->end()
  339.                         ->scalarNode('proxy_user')
  340.                             ->defaultNull()
  341.                         ->end()
  342.                         ->scalarNode('proxy_pass')
  343.                             ->defaultNull()
  344.                         ->end()
  345.                     ->end()
  346.                 ->end()
  347.             ->end();
  348.     }
  349.     /**
  350.      * @param ArrayNodeDefinition $rootNode
  351.      */
  352.     private function addApplicationLogNode(ArrayNodeDefinition $rootNode)
  353.     {
  354.         $rootNode
  355.             ->children()
  356.                 ->arrayNode('applicationlog')
  357.                 ->addDefaultsIfNotSet()
  358.                     ->children()
  359.                         ->arrayNode('mail_notification')
  360.                             ->children()
  361.                                 ->booleanNode('send_log_summary')
  362.                                     ->info('Send log summary via email')
  363.                                     ->beforeNormalization()
  364.                                         ->ifString()
  365.                                         ->then(function ($v) {
  366.                                             return (bool)$v;
  367.                                         })
  368.                                     ->end()
  369.                                     ->defaultFalse()
  370.                                 ->end()
  371.                                 ->scalarNode('filter_priority')
  372.                                     ->info('Filter threshold for email summary, choose one of: 7 (debug), 6 (info), 5 (notice), 4 (warning), 3 (error), 2 (critical), 1 (alert) ,0 (emerg)')
  373.                                     ->defaultNull()
  374.                                 ->end()
  375.                                 ->scalarNode('mail_receiver')
  376.                                 ->info('Log summary receivers. Separate multiple email receivers by using ;')
  377.                                 ->end()
  378.                             ->end()
  379.                         ->end()
  380.                         ->scalarNode('archive_treshold')
  381.                             ->info('Archive threshold in days')
  382.                             ->defaultValue(30)
  383.                         ->end()
  384.                         ->scalarNode('archive_alternative_database')
  385.                             ->info('Archive database name (optional). Tables will get archived to a different database, recommended when huge amounts of logs will be generated')
  386.                             ->defaultValue('')
  387.                         ->end()
  388.                         ->scalarNode('delete_archive_threshold')
  389.                             ->info('Threshold for deleting application log archive tables (in months)')
  390.                             ->defaultValue('6')
  391.                         ->end()
  392.                     ->end()
  393.             ->end();
  394.     }
  395.     /**
  396.      * Add asset specific extension config
  397.      *
  398.      * @param ArrayNodeDefinition $rootNode
  399.      */
  400.     private function addAssetNode(ArrayNodeDefinition $rootNode)
  401.     {
  402.         $assetsNode $rootNode
  403.             ->children()
  404.                 ->arrayNode('assets')
  405.                 ->addDefaultsIfNotSet()
  406.                 ->children()
  407.                     ->arrayNode('frontend_prefixes')
  408.                         ->addDefaultsIfNotSet()
  409.                         ->children()
  410.                             ->scalarNode('source')
  411.                                 ->defaultValue('')
  412.                                 ->end()
  413.                             ->scalarNode('thumbnail')
  414.                                 ->defaultValue('')
  415.                                 ->end()
  416.                             ->scalarNode('thumbnail_deferred')
  417.                                 ->defaultValue('')
  418.                                 ->end()
  419.                         ->end()
  420.                     ->end()
  421.                     ->scalarNode('preview_image_thumbnail')
  422.                         ->defaultNull()
  423.                         ->end()
  424.                     ->scalarNode('default_upload_path')
  425.                         ->defaultValue('_default_upload_bucket')
  426.                         ->end()
  427.                     ->integerNode('tree_paging_limit')
  428.                         ->defaultValue(100)
  429.                         ->end()
  430.                     ->arrayNode('image')
  431.                         ->addDefaultsIfNotSet()
  432.                         ->children()
  433.                             ->integerNode('max_pixels')
  434.                                 ->defaultValue(40000000)
  435.                             ->end()
  436.                             ->arrayNode('low_quality_image_preview')
  437.                                 ->addDefaultsIfNotSet()
  438.                                 ->canBeDisabled()
  439.                             ->end()
  440.                             ->arrayNode('focal_point_detection')
  441.                                 ->addDefaultsIfNotSet()
  442.                                 ->canBeDisabled()
  443.                             ->end()
  444.                             ->arrayNode('thumbnails')
  445.                                 ->addDefaultsIfNotSet()
  446.                                 ->children()
  447.                                     ->arrayNode('definitions')
  448.                                         ->normalizeKeys(false)
  449.                                         ->prototype('array')
  450.                                             ->children()
  451.                                                 ->scalarNode('id')->end()
  452.                                                 ->scalarNode('name')->end()
  453.                                                 ->scalarNode('description')->end()
  454.                                                 ->scalarNode('group')->end()
  455.                                                 ->scalarNode('format')->end()
  456.                                                 ->scalarNode('quality')->end()
  457.                                                 ->scalarNode('highResolution')->end()
  458.                                                 ->booleanNode('preserveColor')->end()
  459.                                                 ->booleanNode('preserveMetaData')->end()
  460.                                                 ->booleanNode('rasterizeSVG')->end()
  461.                                                 ->booleanNode('downloadable')->end()
  462.                                                 ->integerNode('modificationDate')->end()
  463.                                                 ->integerNode('creationDate')->end()
  464.                                                 ->booleanNode('preserveAnimation')->end()
  465.                                                 ->arrayNode('items')
  466.                                                     ->prototype('array')
  467.                                                         ->children()
  468.                                                             ->scalarNode('method')->end()
  469.                                                             ->arrayNode('arguments')
  470.                                                                 ->prototype('variable')->end()
  471.                                                             ->end()
  472.                                                         ->end()
  473.                                                     ->end()
  474.                                                 ->end()
  475.                                                 ->arrayNode('medias')
  476.                                                     ->normalizeKeys(false)
  477.                                                     ->prototype('array')
  478.                                                         ->arrayProtoType()
  479.                                                             ->children()
  480.                                                                 ->scalarNode('method')->end()
  481.                                                                 ->arrayNode('arguments')
  482.                                                                     ->prototype('variable')->end()
  483.                                                                 ->end()
  484.                                                             ->end()
  485.                                                         ->end()
  486.                                                     ->end()
  487.                                                 ->end()
  488.                                             ->end()
  489.                                         ->end()
  490.                                     ->end()
  491.                                     ->booleanNode('clip_auto_support')
  492.                                         ->beforeNormalization()
  493.                                             ->ifString()
  494.                                             ->then(function ($v) {
  495.                                                 return (bool)$v;
  496.                                             })
  497.                                         ->end()
  498.                                         ->defaultTrue()
  499.                                     ->end()
  500.                                     ->arrayNode('image_optimizers')
  501.                                         ->addDefaultsIfNotSet()
  502.                                         ->canBeDisabled()
  503.                                     ->end()
  504.                                     ->arrayNode('auto_formats')
  505.                                         ->prototype('array')
  506.                                             ->canBeDisabled()
  507.                                             ->children()
  508.                                                 ->scalarNode('quality')->end()
  509.                                             ->end()
  510.                                         ->end()
  511.                                         ->defaultValue([
  512.                                             'avif' => [
  513.                                                 'enabled' => true,
  514.                                                 'quality' => 15,
  515.                                             ],
  516.                                             'webp' => [
  517.                                                 'enabled' => true,
  518.                                                 'quality' => null,
  519.                                             ],
  520.                                         ])
  521.                                     ->end()
  522.                                     ->booleanNode('auto_clear_temp_files')
  523.                                         ->beforeNormalization()
  524.                                             ->ifString()
  525.                                             ->then(function ($v) {
  526.                                                 return (bool)$v;
  527.                                             })
  528.                                         ->end()
  529.                                         ->defaultTrue()
  530.                                     ->end()
  531.                                 ->end()
  532.                             ->end()
  533.                         ->end()
  534.                     ->end()
  535.                     ->arrayNode('video')
  536.                         ->addDefaultsIfNotSet()
  537.                         ->children()
  538.                             ->arrayNode('thumbnails')
  539.                                 ->addDefaultsIfNotSet()
  540.                                 ->children()
  541.                                     ->arrayNode('definitions')
  542.                                         ->normalizeKeys(false)
  543.                                         ->prototype('array')
  544.                                             ->children()
  545.                                                 ->scalarNode('id')->end()
  546.                                                 ->scalarNode('name')->end()
  547.                                                 ->scalarNode('description')->end()
  548.                                                 ->scalarNode('group')->end()
  549.                                                 ->scalarNode('videoBitrate')->end()
  550.                                                 ->scalarNode('audioBitrate')->end()
  551.                                                 ->scalarNode('quality')->end()
  552.                                                 ->integerNode('modificationDate')->end()
  553.                                                 ->integerNode('creationDate')->end()
  554.                                                 ->arrayNode('items')
  555.                                                     ->prototype('array')
  556.                                                         ->children()
  557.                                                             ->scalarNode('method')->end()
  558.                                                             ->arrayNode('arguments')
  559.                                                                 ->prototype('variable')->end()
  560.                                                             ->end()
  561.                                                         ->end()
  562.                                                     ->end()
  563.                                                 ->end()
  564.                                                 ->arrayNode('medias')
  565.                                                     ->normalizeKeys(false)
  566.                                                     ->prototype('array')
  567.                                                         ->arrayProtoType()
  568.                                                             ->children()
  569.                                                                 ->scalarNode('method')->end()
  570.                                                                 ->arrayNode('arguments')
  571.                                                                     ->prototype('variable')->end()
  572.                                                                 ->end()
  573.                                                             ->end()
  574.                                                         ->end()
  575.                                                     ->end()
  576.                                                 ->end()
  577.                                             ->end()
  578.                                         ->end()
  579.                                     ->end()
  580.                                     ->booleanNode('auto_clear_temp_files')
  581.                                     ->defaultTrue()
  582.                                     ->end()
  583.                                 ->end()
  584.                             ->end()
  585.                         ->end()
  586.                     ->end()
  587.                     ->arrayNode('versions')
  588.                         ->addDefaultsIfNotSet()
  589.                         ->children()
  590.                             ->scalarNode('days')
  591.                                 ->defaultNull()
  592.                             ->end()
  593.                             ->scalarNode('steps')
  594.                                 ->defaultNull()
  595.                             ->end()
  596.                             ->booleanNode('use_hardlinks')
  597.                                 ->beforeNormalization()
  598.                                     ->ifString()
  599.                                     ->then(function ($v) {
  600.                                         return (bool)$v;
  601.                                     })
  602.                                 ->end()
  603.                                 ->defaultTrue()
  604.                             ->end()
  605.                             ->booleanNode('disable_stack_trace')
  606.                                 ->beforeNormalization()
  607.                                     ->ifString()
  608.                                     ->then(function ($v) {
  609.                                         return (bool)$v;
  610.                                     })
  611.                                 ->end()
  612.                                 ->defaultFalse()
  613.                             ->end()
  614.                         ->end()
  615.                     ->end()
  616.                     ->scalarNode('icc_rgb_profile')
  617.                         ->info('Absolute path to default ICC RGB profile (if no embedded profile is given)')
  618.                         ->defaultNull()
  619.                     ->end()
  620.                     ->scalarNode('icc_cmyk_profile')
  621.                         ->info('Absolute path to default ICC CMYK profile (if no embedded profile is given)')
  622.                         ->defaultNull()
  623.                     ->end()
  624.                     ->booleanNode('hide_edit_image')
  625.                         ->defaultFalse()
  626.                     ->end()
  627.                     ->booleanNode('disable_tree_preview')
  628.                         ->defaultTrue()
  629.                     ->end()
  630.                 ->end();
  631.         $assetsNode
  632.             ->children()
  633.                 ->arrayNode('metadata')
  634.                 ->addDefaultsIfNotSet()
  635.                     ->children()
  636.                         ->arrayNode('predefined')
  637.                             ->children()
  638.                                 ->arrayNode('definitions')
  639.                                 ->normalizeKeys(false)
  640.                                     ->prototype('array')
  641.                                         ->children()
  642.                                             ->scalarNode('name')->end()
  643.                                             ->scalarNode('description')->end()
  644.                                             ->scalarNode('group')->end()
  645.                                             ->scalarNode('language')->end()
  646.                                             ->scalarNode('type')->end()
  647.                                             ->scalarNode('data')->end()
  648.                                             ->scalarNode('targetSubtype')->end()
  649.                                             ->scalarNode('config')->end()
  650.                                             ->booleanNode('inheritable')
  651.                                                 ->beforeNormalization()
  652.                                                 ->ifString()
  653.                                                 ->then(function ($v) {
  654.                                                     return (bool)$v;
  655.                                                 })
  656.                                                 ->end()
  657.                                             ->end()
  658.                                             ->integerNode('creationDate')->end()
  659.                                             ->integerNode('modificationDate')->end()
  660.                                         ->end()
  661.                                     ->end()
  662.                                 ->end()
  663.                             ->end()
  664.                         ->end()
  665.                         ->arrayNode('class_definitions')
  666.                             ->children()
  667.                                 ->arrayNode('data')
  668.                                     ->children()
  669.                                         ->arrayNode('map')
  670.                                             ->useAttributeAsKey('name')
  671.                                             ->prototype('scalar')->end()
  672.                                         ->end()
  673.                                         ->arrayNode('prefixes')
  674.                                             ->prototype('scalar')->end()
  675.                                         ->end()
  676.                                     ->end()
  677.                                 ->end()
  678.                             ->end()
  679.                         ->end();
  680.     }
  681.     /**
  682.      * Add object specific extension config
  683.      *
  684.      * @param ArrayNodeDefinition $rootNode
  685.      */
  686.     private function addObjectsNode(ArrayNodeDefinition $rootNode)
  687.     {
  688.         $objectsNode $rootNode
  689.             ->children()
  690.                 ->arrayNode('objects')
  691.                     ->ignoreExtraKeys()
  692.                     ->addDefaultsIfNotSet()
  693.                     ->children()
  694.                         ->booleanNode('ignore_localized_query_fallback')
  695.                             ->beforeNormalization()
  696.                             ->ifString()
  697.                                 ->then(function ($v) {
  698.                                     return (bool)$v;
  699.                                 })
  700.                                 ->end()
  701.                             ->defaultFalse()
  702.                         ->end()
  703.                         ->integerNode('tree_paging_limit')
  704.                             ->defaultValue(30)
  705.                         ->end()
  706.                         ->integerNode('auto_save_interval')
  707.                             ->defaultValue(60)
  708.                         ->end()
  709.                         ->arrayNode('versions')
  710.                             ->children()
  711.                                 ->scalarNode('days')->defaultNull()->end()
  712.                                 ->scalarNode('steps')->defaultNull()->end()
  713.                                 ->booleanNode('disable_stack_trace')
  714.                                     ->beforeNormalization()
  715.                                     ->ifString()
  716.                                         ->then(function ($v) {
  717.                                             return (bool)$v;
  718.                                         })
  719.                                     ->end()
  720.                                     ->defaultFalse()
  721.                                 ->end()
  722.                             ->end()
  723.                         ->end()
  724.                     ->end();
  725.         $classDefinitionsNode $objectsNode
  726.             ->children()
  727.                 ->arrayNode('class_definitions')
  728.                     ->addDefaultsIfNotSet();
  729.         $this->addImplementationLoaderNode($classDefinitionsNode'data');
  730.         $this->addImplementationLoaderNode($classDefinitionsNode'layout');
  731.     }
  732.     /**
  733.      * Add encryption specific extension config
  734.      *
  735.      * @param ArrayNodeDefinition $rootNode
  736.      */
  737.     private function addEncryptionNode(ArrayNodeDefinition $rootNode)
  738.     {
  739.         $encryptionNode $rootNode
  740.             ->children()
  741.             ->arrayNode('encryption')->addDefaultsIfNotSet();
  742.         $encryptionNode
  743.             ->children()
  744.             ->scalarNode('secret')->defaultNull();
  745.     }
  746.     /**
  747.      * Add document specific extension config
  748.      *
  749.      * @param ArrayNodeDefinition $rootNode
  750.      */
  751.     private function addDocumentsNode(ArrayNodeDefinition $rootNode)
  752.     {
  753.         $documentsNode $rootNode
  754.             ->children()
  755.                 ->arrayNode('documents')
  756.                     ->ignoreExtraKeys()
  757.                     ->addDefaultsIfNotSet();
  758.         $documentsNode
  759.             ->children()
  760.                  ->arrayNode('doc_types')
  761.                     ->addDefaultsIfNotSet()
  762.                     ->children()
  763.                         ->arrayNode('definitions')
  764.                         ->normalizeKeys(false)
  765.                             ->prototype('array')
  766.                                 ->children()
  767.                                     ->scalarNode('name')->end()
  768.                                     ->scalarNode('group')->end()
  769.                                     ->scalarNode('module')->end()
  770.                                     ->scalarNode('controller')->end()
  771.                                     ->scalarNode('template')->end()
  772.                                     ->scalarNode('type')->end()
  773.                                     ->integerNode('priority')->end()
  774.                                     ->integerNode('creationDate')->end()
  775.                                     ->integerNode('modificationDate')->end()
  776.                                     ->scalarNode('staticGeneratorEnabled')->end()
  777.                                 ->end()
  778.                             ->end()
  779.                         ->end()
  780.                     ->end()
  781.                 ->end()
  782.                 ->arrayNode('versions')
  783.                     ->children()
  784.                         ->scalarNode('days')
  785.                             ->defaultNull()
  786.                         ->end()
  787.                         ->scalarNode('steps')
  788.                             ->defaultNull()
  789.                         ->end()
  790.                         ->booleanNode('disable_stack_trace')
  791.                             ->beforeNormalization()
  792.                             ->ifString()
  793.                                 ->then(function ($v) {
  794.                                     return (bool)$v;
  795.                                 })
  796.                             ->end()
  797.                             ->defaultFalse()
  798.                         ->end()
  799.                     ->end()
  800.                 ->end()
  801.                 ->scalarNode('default_controller')
  802.                     ->defaultValue('App\\Controller\\DefaultController::defaultAction')
  803.                 ->end()
  804.                 ->arrayNode('error_pages')
  805.                     ->children()
  806.                         ->scalarNode('default')
  807.                             ->defaultNull()
  808.                         ->end()
  809.                         ->arrayNode('localized')
  810.                             ->performNoDeepMerging()
  811.                             ->beforeNormalization()
  812.                                 ->ifArray()
  813.                                     ->then(function ($v) {
  814.                                         return $v;
  815.                                     })
  816.                             ->end()
  817.                             ->prototype('scalar')
  818.                             ->end()
  819.                         ->end()
  820.                     ->end()
  821.                 ->end()
  822.                 ->scalarNode('allow_trailing_slash')
  823.                     ->defaultValue('no')
  824.                 ->end()
  825.                 ->booleanNode('generate_preview')
  826.                     ->beforeNormalization()
  827.                         ->ifString()
  828.                         ->then(function ($v) {
  829.                             return (bool)$v;
  830.                         })
  831.                     ->end()
  832.                     ->defaultFalse()
  833.                 ->end()
  834.                 ->integerNode('tree_paging_limit')
  835.                     ->defaultValue(50)
  836.                 ->end()
  837.                 ->arrayNode('editables')
  838.                     ->addDefaultsIfNotSet()
  839.                     ->children()
  840.                         ->arrayNode('map')
  841.                             ->useAttributeAsKey('name')
  842.                             ->prototype('scalar')->end()
  843.                         ->end()
  844.                         ->arrayNode('prefixes')
  845.                             ->prototype('scalar')->end()
  846.                         ->end()
  847.                     ->end()
  848.                 ->end()
  849.                 ->arrayNode('types')
  850.                     ->info('list of supported document types')
  851.                     ->scalarPrototype()->end()
  852.                 ->end()
  853.                 ->arrayNode('valid_tables')
  854.                     ->info('list of supported documents_* tables')
  855.                     ->scalarPrototype()->end()
  856.                 ->end()
  857.                 ->arrayNode('areas')
  858.                     ->addDefaultsIfNotSet()
  859.                     ->children()
  860.                         ->booleanNode('autoload')
  861.                             ->beforeNormalization()
  862.                                 ->ifString()
  863.                                 ->then(function ($v) {
  864.                                     return (bool)$v;
  865.                                 })
  866.                             ->end()
  867.                             ->defaultTrue()
  868.                         ->end()
  869.                     ->end()
  870.                 ->end()
  871.                 ->arrayNode('newsletter')
  872.                     ->addDefaultsIfNotSet()
  873.                     ->children()
  874.                         ->scalarNode('defaultUrlPrefix')
  875.                             ->defaultNull()
  876.                         ->end()
  877.                     ->end()
  878.                 ->end()
  879.                 ->arrayNode('web_to_print')
  880.                     ->addDefaultsIfNotSet()
  881.                         ->children()
  882.                             ->scalarNode('pdf_creation_php_memory_limit')
  883.                                 ->defaultValue('2048M')
  884.                             ->end()
  885.                             ->scalarNode('default_controller_print_page')
  886.                                 ->defaultValue('App\\Controller\\Web2printController::defaultAction')
  887.                             ->end()
  888.                             ->scalarNode('default_controller_print_container')
  889.                                 ->defaultValue('App\\Controller\\Web2printController::containerAction')
  890.                             ->end()
  891.                             ->booleanNode('enableInDefaultView')->end()
  892.                             ->scalarNode('generalTool')->end()
  893.                             ->scalarNode('generalDocumentSaveMode')->end()
  894.                             ->scalarNode('pdfreactorVersion')->end()
  895.                             ->scalarNode('pdfreactorProtocol')->end()
  896.                             ->scalarNode('pdfreactorServer')->end()
  897.                             ->scalarNode('pdfreactorServerPort')->end()
  898.                             ->scalarNode('pdfreactorBaseUrl')->end()
  899.                             ->scalarNode('pdfreactorApiKey')->end()
  900.                             ->scalarNode('pdfreactorLicence')->end()
  901.                             ->booleanNode('pdfreactorEnableLenientHttpsMode')->end()
  902.                             ->booleanNode('pdfreactorEnableDebugMode')->end()
  903.                             ->scalarNode('wkhtmltopdfBin')->end()
  904.                             ->variableNode('wkhtml2pdfOptions')->end()
  905.                             ->scalarNode('wkhtml2pdfHostname')->end()
  906.                             ->scalarNode('headlessChromeSettings')->end()
  907.                         ->end()
  908.                 ->end()
  909.                 ->integerNode('auto_save_interval')
  910.                     ->defaultValue(60)
  911.                 ->end()
  912.                 ->arrayNode('static_page_router')
  913.                     ->addDefaultsIfNotSet()
  914.                     ->children()
  915.                         ->booleanNode('enabled')
  916.                             ->defaultFalse()
  917.                             ->info('Enable Static Page router for document when using remote storage for generated pages')
  918.                         ->end()
  919.                         ->scalarNode('route_pattern')
  920.                             ->defaultNull()
  921.                             ->info('Optionally define route patterns to lookup static pages. Regular Expressions like: /^\/en\/Magazine/')
  922.                         ->end()
  923.                 ->end()
  924.             ->end();
  925.     }
  926.     /**
  927.      * Add implementation node config (map, prefixes)
  928.      *
  929.      * @param ArrayNodeDefinition $node
  930.      * @param string $name
  931.      */
  932.     private function addImplementationLoaderNode(ArrayNodeDefinition $node$name)
  933.     {
  934.         $node
  935.             ->children()
  936.                 ->arrayNode($name)
  937.                     ->addDefaultsIfNotSet()
  938.                     ->children()
  939.                         ->arrayNode('map')
  940.                             ->useAttributeAsKey('name')
  941.                             ->prototype('scalar')->end()
  942.                         ->end()
  943.                         ->arrayNode('prefixes')
  944.                             ->prototype('scalar')->end()
  945.                         ->end()
  946.                     ->end()
  947.                 ->end()
  948.             ->end();
  949.     }
  950.     private function addRoutingNode(ArrayNodeDefinition $rootNode)
  951.     {
  952.         $rootNode
  953.             ->children()
  954.                 ->arrayNode('routing')
  955.                     ->addDefaultsIfNotSet()
  956.                     ->children()
  957.                         ->booleanNode('allow_processing_unpublished_fallback_document')
  958.                             ->beforeNormalization()
  959.                                 ->ifString()
  960.                                 ->then(function ($v) {
  961.                                     return (bool)$v;
  962.                                 })
  963.                             ->end()
  964.                             ->defaultFalse()
  965.                             ->setDeprecated(
  966.                                 'pimcore/pimcore',
  967.                                 '10.1',
  968.                                 'The "%node%" option is deprecated since Pimcore 10.1, it will be removed in Pimcore 11.'
  969.                             )
  970.                         ->end()
  971.                         ->arrayNode('direct_route_document_types')
  972.                             ->scalarPrototype()->end()
  973.                         ->end()
  974.                         ->arrayNode('static')
  975.                             ->addDefaultsIfNotSet()
  976.                             ->children()
  977.                                 ->arrayNode('locale_params')
  978.                                     ->info('Route params from this list will be mapped to _locale if _locale is not set explicitely')
  979.                                     ->prototype('scalar')
  980.                                     ->defaultValue([])
  981.                                 ->end()
  982.                             ->end()
  983.                         ->end()
  984.                     ->end()
  985.                 ->end();
  986.     }
  987.     /**
  988.      * Add context config
  989.      *
  990.      * @param ArrayNodeDefinition $rootNode
  991.      */
  992.     private function addContextNode(ArrayNodeDefinition $rootNode)
  993.     {
  994.         $contextNode $rootNode->children()
  995.             ->arrayNode('context')
  996.             ->useAttributeAsKey('name');
  997.         /** @var ArrayNodeDefinition|NodeDefinition $prototype */
  998.         $prototype $contextNode->prototype('array');
  999.         // define routes child on each context entry
  1000.         $this->addRoutesChild($prototype'routes');
  1001.     }
  1002.     /**
  1003.      * Add admin config
  1004.      *
  1005.      * @param ArrayNodeDefinition $rootNode
  1006.      */
  1007.     private function addAdminNode(ArrayNodeDefinition $rootNode)
  1008.     {
  1009.         $adminNode $rootNode->children()
  1010.             ->arrayNode('admin')
  1011.             ->ignoreExtraKeys()
  1012.             ->addDefaultsIfNotSet();
  1013.         // add session attribute bag config
  1014.         $this->addAdminSessionAttributeBags($adminNode);
  1015.         // unauthenticated routes won't be double checked for authentication in AdminControllerListener
  1016.         $this->addRoutesChild($adminNode'unauthenticated_routes');
  1017.         $adminNode
  1018.             ->children()
  1019.                 ->arrayNode('translations')
  1020.                     ->addDefaultsIfNotSet()
  1021.                     ->children()
  1022.                         ->scalarNode('path')->defaultNull()->end()
  1023.                     ->end()
  1024.                 ->end()
  1025.             ->end();
  1026.     }
  1027.     /**
  1028.      * @param ArrayNodeDefinition $adminNode
  1029.      */
  1030.     private function addAdminSessionAttributeBags(ArrayNodeDefinition $adminNode)
  1031.     {
  1032.         // Normalizes session bag config. Allows the following formats (all formats will be
  1033.         // normalized to the third format.
  1034.         //
  1035.         // attribute_bags:
  1036.         //      - foo
  1037.         //      - bar
  1038.         //
  1039.         // attribute_bags:
  1040.         //      foo: _foo
  1041.         //      bar: _bar
  1042.         //
  1043.         // attribute_bags:
  1044.         //      foo:
  1045.         //          storage_key: _foo
  1046.         //      bar:
  1047.         //          storage_key: _bar
  1048.         $normalizers = [
  1049.             'assoc' => function (array $array) {
  1050.                 $result = [];
  1051.                 foreach ($array as $name => $value) {
  1052.                     if (null === $value) {
  1053.                         $value = [
  1054.                             'storage_key' => '_' $name,
  1055.                         ];
  1056.                     }
  1057.                     if (is_string($value)) {
  1058.                         $value = [
  1059.                             'storage_key' => $value,
  1060.                         ];
  1061.                     }
  1062.                     $result[$name] = $value;
  1063.                 }
  1064.                 return $result;
  1065.             },
  1066.             'sequential' => function (array $array) {
  1067.                 $result = [];
  1068.                 foreach ($array as $name) {
  1069.                     $result[$name] = [
  1070.                         'storage_key' => '_' $name,
  1071.                     ];
  1072.                 }
  1073.                 return $result;
  1074.             },
  1075.         ];
  1076.         $adminNode
  1077.             ->children()
  1078.                 ->arrayNode('session')
  1079.                     ->addDefaultsIfNotSet()
  1080.                     ->children()
  1081.                         ->arrayNode('attribute_bags')
  1082.                             ->useAttributeAsKey('name')
  1083.                             ->beforeNormalization()
  1084.                                 ->ifArray()->then(function ($v) use ($normalizers) {
  1085.                                     if (isAssocArray($v)) {
  1086.                                         return $normalizers['assoc']($v);
  1087.                                     } else {
  1088.                                         return $normalizers['sequential']($v);
  1089.                                     }
  1090.                                 })
  1091.                             ->end()
  1092.                             ->example([
  1093.                                 ['foo''bar'],
  1094.                                 [
  1095.                                     'foo' => '_foo',
  1096.                                     'bar' => '_bar',
  1097.                                 ],
  1098.                                 [
  1099.                                     'foo' => [
  1100.                                         'storage_key' => '_foo',
  1101.                                     ],
  1102.                                     'bar' => [
  1103.                                         'storage_key' => '_bar',
  1104.                                     ],
  1105.                                 ],
  1106.                             ])
  1107.                             ->prototype('array')
  1108.                                 ->children()
  1109.                                     ->scalarNode('storage_key')
  1110.                                         ->defaultNull()
  1111.                                     ->end()
  1112.                                 ->end()
  1113.                             ->end()
  1114.                         ->end()
  1115.                     ->end()
  1116.                 ->end()
  1117.             ->end();
  1118.     }
  1119.     private function addSecurityNode(ArrayNodeDefinition $rootNode)
  1120.     {
  1121.         $rootNode
  1122.             ->children()
  1123.                 ->arrayNode('security')
  1124.                     ->addDefaultsIfNotSet()
  1125.                     ->children()
  1126.                         ->enumNode('factory_type')
  1127.                             ->values(['encoder''password_hasher'])
  1128.                             ->defaultValue('encoder')
  1129.                         ->end()
  1130.                         ->arrayNode('encoder_factories')
  1131.                             ->info('Encoder factories to use as className => factory service ID mapping')
  1132.                             ->example([
  1133.                                 'App\Model\DataObject\User1' => [
  1134.                                     'id' => 'website_demo.security.encoder_factory2',
  1135.                                 ],
  1136.                                 'App\Model\DataObject\User2' => 'website_demo.security.encoder_factory2',
  1137.                             ])
  1138.                             ->useAttributeAsKey('class')
  1139.                             ->prototype('array')
  1140.                             ->beforeNormalization()->ifString()->then(function ($v) {
  1141.                                 return ['id' => $v];
  1142.                             })->end()
  1143.                             ->children()
  1144.                                 ->scalarNode('id')->end()
  1145.                             ->end()
  1146.                             ->end()
  1147.                         ->end()
  1148.                         ->arrayNode('password_hasher_factories')
  1149.                             ->info('Password hasher factories to use as className => factory service ID mapping')
  1150.                             ->example([
  1151.                                 'App\Model\DataObject\User1' => [
  1152.                                     'id' => 'website_demo.security.encoder_factory2',
  1153.                                 ],
  1154.                                 'App\Model\DataObject\User2' => 'website_demo.security.encoder_factory2',
  1155.                             ])
  1156.                             ->useAttributeAsKey('class')
  1157.                             ->prototype('array')
  1158.                             ->beforeNormalization()->ifString()->then(function ($v) {
  1159.                                 return ['id' => $v];
  1160.                             })->end()
  1161.                             ->children()
  1162.                             ->scalarNode('id')->end()
  1163.                             ->end()
  1164.                         ->end()
  1165.                     ->end()
  1166.                 ->end()
  1167.             ->end();
  1168.     }
  1169.     /**
  1170.      * Configure exclude paths for web profiler toolbar
  1171.      *
  1172.      * @param ArrayNodeDefinition $rootNode
  1173.      */
  1174.     private function addWebProfilerNode(ArrayNodeDefinition $rootNode)
  1175.     {
  1176.         $webProfilerNode $rootNode->children()
  1177.             ->arrayNode('web_profiler')
  1178.                 ->example([
  1179.                     'toolbar' => [
  1180.                         'excluded_routes' => [
  1181.                             ['path' => '^/test/path'],
  1182.                         ],
  1183.                     ],
  1184.                 ])
  1185.                 ->addDefaultsIfNotSet();
  1186.         $toolbarNode $webProfilerNode->children()
  1187.             ->arrayNode('toolbar')
  1188.                 ->addDefaultsIfNotSet();
  1189.         $this->addRoutesChild($toolbarNode'excluded_routes');
  1190.     }
  1191.     /**
  1192.      * Add a route prototype child
  1193.      *
  1194.      * @param ArrayNodeDefinition $parent
  1195.      * @param string $name
  1196.      */
  1197.     private function addRoutesChild(ArrayNodeDefinition $parent$name)
  1198.     {
  1199.         $node $parent->children()->arrayNode($name);
  1200.         /** @var ArrayNodeDefinition $prototype */
  1201.         $prototype $node->prototype('array');
  1202.         $prototype
  1203.             ->beforeNormalization()
  1204.                 ->ifNull()->then(function () {
  1205.                     return [];
  1206.                 })
  1207.             ->end()
  1208.             ->children()
  1209.                 ->scalarNode('path')->defaultFalse()->end()
  1210.                 ->scalarNode('route')->defaultFalse()->end()
  1211.                 ->scalarNode('host')->defaultFalse()->end()
  1212.                 ->arrayNode('methods')
  1213.                     ->prototype('scalar')->end()
  1214.                 ->end()
  1215.             ->end();
  1216.     }
  1217.     /**
  1218.      * Add cache config
  1219.      *
  1220.      * @param ArrayNodeDefinition $rootNode
  1221.      */
  1222.     private function addCacheNode(ArrayNodeDefinition $rootNode)
  1223.     {
  1224.         $rootNode->children()
  1225.             ->arrayNode('full_page_cache')
  1226.                 ->ignoreExtraKeys()
  1227.                 ->canBeDisabled()
  1228.                 ->addDefaultsIfNotSet()
  1229.                 ->children()
  1230.                     ->scalarNode('lifetime')
  1231.                         ->info('Optional output-cache lifetime (in seconds) after the cache expires, if not defined the cache will be cleaned on every action inside the CMS, otherwise not (for high traffic sites)')
  1232.                         ->defaultNull()
  1233.                     ->end()
  1234.                     ->scalarNode('exclude_patterns')
  1235.                         ->info('Regular Expressions like: /^\/dir\/toexclude/')
  1236.                     ->end()
  1237.                     ->scalarNode('exclude_cookie')
  1238.                         ->info('Comma separated list of cookie names, that will automatically disable the full-page cache')
  1239.                     ->end()
  1240.                 ->end()
  1241.             ->end();
  1242.     }
  1243.     /**
  1244.      * Adds configuration for email source adapters
  1245.      *
  1246.      * @param ArrayNodeDefinition $rootNode
  1247.      */
  1248.     private function addEmailNode(ArrayNodeDefinition $rootNode)
  1249.     {
  1250.         $rootNode
  1251.             ->children()
  1252.                 ->arrayNode('email')
  1253.                 ->addDefaultsIfNotSet()
  1254.                     ->children()
  1255.                         ->arrayNode('sender')
  1256.                             ->addDefaultsIfNotSet()
  1257.                             ->children()
  1258.                                 ->scalarNode('name')
  1259.                                     ->defaultValue('')
  1260.                                 ->end()
  1261.                                 ->scalarNode('email')
  1262.                                     ->defaultValue('')
  1263.                                 ->end()
  1264.                             ->end()
  1265.                         ->end()
  1266.                         ->arrayNode('return')
  1267.                             ->addDefaultsIfNotSet()
  1268.                             ->children()
  1269.                                 ->scalarNode('name')
  1270.                                     ->defaultValue('')
  1271.                                 ->end()
  1272.                                 ->scalarNode('email')
  1273.                                     ->defaultValue('')
  1274.                                 ->end()
  1275.                             ->end()
  1276.                         ->end()
  1277.                         ->arrayNode('debug')
  1278.                             ->addDefaultsIfNotSet()
  1279.                             ->children()
  1280.                                 ->scalarNode('email_addresses')
  1281.                                     ->defaultValue('')
  1282.                                 ->end()
  1283.                             ->end()
  1284.                         ->end()
  1285.                         ->scalarNode('usespecific')
  1286.                             ->defaultFalse()
  1287.                         ->end()
  1288.                     ->end()
  1289.                 ->end()
  1290.             ->end();
  1291.     }
  1292.     /**
  1293.      * Adds configuration tree for newsletter source adapters
  1294.      *
  1295.      * @param ArrayNodeDefinition $rootNode
  1296.      */
  1297.     private function addNewsletterNode(ArrayNodeDefinition $rootNode)
  1298.     {
  1299.         $rootNode
  1300.             ->children()
  1301.                 ->arrayNode('newsletter')
  1302.                     ->addDefaultsIfNotSet()
  1303.                     ->children()
  1304.                         ->arrayNode('sender')
  1305.                             ->children()
  1306.                                 ->scalarNode('name')->end()
  1307.                                 ->scalarNode('email')->end()
  1308.                             ->end()
  1309.                         ->end()
  1310.                         ->arrayNode('return')
  1311.                             ->children()
  1312.                                 ->scalarNode('name')->end()
  1313.                                 ->scalarNode('email')->end()
  1314.                             ->end()
  1315.                         ->end()
  1316.                         ->scalarNode('method')
  1317.                             ->defaultNull()
  1318.                         ->end()
  1319.                         ->arrayNode('debug')
  1320.                             ->children()
  1321.                                 ->scalarNode('email_addresses')
  1322.                                     ->defaultValue('')
  1323.                                 ->end()
  1324.                             ->end()
  1325.                         ->end()
  1326.                         ->booleanNode('use_specific')
  1327.                             ->beforeNormalization()
  1328.                                 ->ifString()
  1329.                                 ->then(function ($v) {
  1330.                                     return (bool)$v;
  1331.                                 })
  1332.                             ->end()
  1333.                         ->end()
  1334.                         ->arrayNode('source_adapters')
  1335.                             ->useAttributeAsKey('name')
  1336.                                 ->prototype('scalar')
  1337.                             ->end()
  1338.                         ->end()
  1339.                     ->end()
  1340.                 ->end()
  1341.             ->end();
  1342.     }
  1343.     /**
  1344.      * Adds configuration tree for custom report adapters
  1345.      *
  1346.      * @param ArrayNodeDefinition $rootNode
  1347.      */
  1348.     private function addCustomReportsNode(ArrayNodeDefinition $rootNode)
  1349.     {
  1350.         $rootNode
  1351.             ->children()
  1352.                 ->arrayNode('custom_report')
  1353.                     ->addDefaultsIfNotSet()
  1354.                     ->children()
  1355.                         ->arrayNode('definitions')
  1356.                                 ->normalizeKeys(false)
  1357.                                 ->prototype('array')
  1358.                                     ->children()
  1359.                                         ->scalarNode('id')->end()
  1360.                                         ->scalarNode('name')->end()
  1361.                                         ->scalarNode('niceName')->end()
  1362.                                         ->scalarNode('sql')->end()
  1363.                                         ->scalarNode('group')->end()
  1364.                                         ->scalarNode('groupIconClass')->end()
  1365.                                         ->scalarNode('iconClass')->end()
  1366.                                         ->booleanNode('menuShortcut')->end()
  1367.                                         ->scalarNode('reportClass')->end()
  1368.                                         ->scalarNode('chartType')->end()
  1369.                                         ->scalarNode('pieColumn')->end()
  1370.                                         ->scalarNode('pieLabelColumn')->end()
  1371.                                         ->variableNode('xAxis')->end()
  1372.                                         ->variableNode('yAxis')->end()
  1373.                                         ->integerNode('modificationDate')->end()
  1374.                                         ->integerNode('creationDate')->end()
  1375.                                         ->booleanNode('shareGlobally')->end()
  1376.                                         ->variableNode('sharedUserNames')->end()
  1377.                                         ->variableNode('sharedRoleNames')->end()
  1378.                                         ->arrayNode('dataSourceConfig')
  1379.                                             ->prototype('variable')
  1380.                                             ->end()
  1381.                                         ->end()
  1382.                                         ->arrayNode('columnConfiguration')
  1383.                                             ->prototype('variable')
  1384.                                             ->end()
  1385.                                         ->end()
  1386.                                     ->end()
  1387.                                 ->end()
  1388.                         ->end()
  1389.                         ->arrayNode('adapters')
  1390.                             ->useAttributeAsKey('name')
  1391.                                 ->prototype('scalar')
  1392.                             ->end()
  1393.                         ->end()
  1394.                     ->end()
  1395.                 ->end()
  1396.             ->end();
  1397.     }
  1398.     private function addTargetingNode(ArrayNodeDefinition $rootNode)
  1399.     {
  1400.         $rootNode
  1401.             ->children()
  1402.                 ->arrayNode('targeting')
  1403.                     ->canBeDisabled()
  1404.                     ->addDefaultsIfNotSet()
  1405.                     ->children()
  1406.                         ->scalarNode('storage_id')
  1407.                             ->info('Service ID of the targeting storage which should be used. This ID will be aliased to ' TargetingStorageInterface::class)
  1408.                             ->defaultValue(CookieStorage::class)
  1409.                             ->cannotBeEmpty()
  1410.                         ->end()
  1411.                         ->arrayNode('session')
  1412.                             ->info('Enables HTTP session support by configuring session bags and the full page cache')
  1413.                             ->canBeEnabled()
  1414.                         ->end()
  1415.                         ->arrayNode('data_providers')
  1416.                             ->useAttributeAsKey('key')
  1417.                                 ->prototype('scalar')
  1418.                             ->end()
  1419.                         ->end()
  1420.                         ->arrayNode('conditions')
  1421.                             ->useAttributeAsKey('key')
  1422.                                 ->prototype('scalar')
  1423.                             ->end()
  1424.                         ->end()
  1425.                         ->arrayNode('action_handlers')
  1426.                             ->useAttributeAsKey('name')
  1427.                                 ->prototype('scalar')
  1428.                             ->end()
  1429.                         ->end()
  1430.                     ->end()
  1431.                 ->end()
  1432.             ->end();
  1433.     }
  1434.     private function addSitemapsNode(ArrayNodeDefinition $rootNode)
  1435.     {
  1436.         $rootNode
  1437.             ->children()
  1438.                 ->arrayNode('sitemaps')
  1439.                     ->addDefaultsIfNotSet()
  1440.                     ->children()
  1441.                         ->arrayNode('generators')
  1442.                             ->useAttributeAsKey('name')
  1443.                             ->prototype('array')
  1444.                                 ->beforeNormalization()
  1445.                                     ->ifString()
  1446.                                     ->then(function ($v) {
  1447.                                         return [
  1448.                                             'enabled' => true,
  1449.                                             'generator_id' => $v,
  1450.                                             'priority' => 0,
  1451.                                         ];
  1452.                                     })
  1453.                                 ->end()
  1454.                                 ->addDefaultsIfNotSet()
  1455.                                 ->canBeDisabled()
  1456.                                 ->children()
  1457.                                     ->scalarNode('generator_id')
  1458.                                         ->cannotBeEmpty()
  1459.                                     ->end()
  1460.                                     ->integerNode('priority')
  1461.                                         ->defaultValue(0)
  1462.                                     ->end()
  1463.                                 ->end()
  1464.                             ->end()
  1465.                         ->end()
  1466.                     ->end()
  1467.                 ->end()
  1468.             ->end()
  1469.         ->end();
  1470.     }
  1471.     private function addWorkflowNode(ArrayNodeDefinition $rootNode)
  1472.     {
  1473.         $rootNode
  1474.             ->children()
  1475.                  ->arrayNode('workflows')
  1476.                         ->useAttributeAsKey('name')
  1477.                         ->prototype('array')
  1478.                             ->children()
  1479.                                 ->arrayNode('placeholders')
  1480.                                     ->info('Placeholder values in this workflow configuration (locale: "%%locale%%") will be replaced by the given placeholder value (eg. "de_AT")')
  1481.                                     ->example([
  1482.                                         'placeholders' => [
  1483.                                             '%%locale%%' => 'de_AT',
  1484.                                         ],
  1485.                                     ])
  1486.                                     ->defaultValue([])
  1487.                                     ->beforeNormalization()
  1488.                                         ->castToArray()
  1489.                                         ->always()
  1490.                                         ->then(function ($placeholders) {
  1491.                                             $this->placeholders $placeholders;
  1492.                                             return $placeholders;
  1493.                                         })
  1494.                                     ->end()
  1495.                                     ->prototype('scalar')->end()
  1496.                                 ->end()
  1497.                                 ->arrayNode('custom_extensions')->ignoreExtraKeys(false)->info('Use this key to attach additional config information to a workflow, for example via bundles, etc.')->end()
  1498.                                 ->booleanNode('enabled')
  1499.                                     ->defaultTrue()
  1500.                                     ->info('Can be used to enable or disable the workflow.')
  1501.                                 ->end()
  1502.                                 ->integerNode('priority')
  1503.                                     ->defaultValue(0)
  1504.                                     ->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.')
  1505.                                 ->end()
  1506.                                 ->scalarNode('label')
  1507.                                     ->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.')
  1508.                                 ->end()
  1509.                                 ->arrayNode('audit_trail')
  1510.                                     ->canBeEnabled()
  1511.                                     ->info('Enable default audit trail feature provided by Symfony. Take a look at the Symfony docs for more details.')
  1512.                                 ->end()
  1513.                                 ->enumNode('type')
  1514.                                     ->values(['workflow''state_machine'])
  1515.                                     ->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.')
  1516.                                 ->end()
  1517.                                 ->arrayNode('marking_store')
  1518.                                     ->fixXmlConfig('argument')
  1519.                                     ->children()
  1520.                                         ->enumNode('type')
  1521.                                             ->values(['multiple_state''single_state''state_table''data_object_multiple_state''data_object_splitted_state'])
  1522.                                         ->end()
  1523.                                         ->arrayNode('arguments')
  1524.                                             ->beforeNormalization()
  1525.                                                 ->always()
  1526.                                                 ->then(function ($arguments) {
  1527.                                                     if (is_string($arguments)) {
  1528.                                                         $arguments = [$arguments];
  1529.                                                     }
  1530.                                                     if (!empty($this->placeholders)) {
  1531.                                                         $arguments $this->placeholderProcessor->mergePlaceholders($arguments$this->placeholders);
  1532.                                                     }
  1533.                                                     return $arguments;
  1534.                                                 })
  1535.                                             ->end()
  1536.                                             ->requiresAtLeastOneElement()
  1537.                                             ->prototype('variable')
  1538.                                             ->end()
  1539.                                         ->end()
  1540.                                         ->scalarNode('service')
  1541.                                             ->cannotBeEmpty()
  1542.                                         ->end()
  1543.                                     ->end()
  1544.                                     ->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.')
  1545.                                     ->validate()
  1546.                                         ->ifTrue(function ($v) {
  1547.                                             return isset($v['type']) && isset($v['service']);
  1548.                                         })
  1549.                                         ->thenInvalid('"type" and "service" cannot be used together.')
  1550.                                     ->end()
  1551.                                     ->validate()
  1552.                                         ->ifTrue(function ($v) {
  1553.                                             return !empty($v['arguments']) && isset($v['service']);
  1554.                                         })
  1555.                                         ->thenInvalid('"arguments" and "service" cannot be used together.')
  1556.                                     ->end()
  1557.                                 ->end()
  1558.                                 ->arrayNode('supports')
  1559.                                     ->beforeNormalization()
  1560.                                         ->ifString()
  1561.                                         ->then(function ($v) {
  1562.                                             return [$v];
  1563.                                         })
  1564.                                     ->end()
  1565.                                     ->prototype('scalar')
  1566.                                         ->cannotBeEmpty()
  1567.                                     ->end()
  1568.                                     ->info('List of supported entity classes. Take a look at the Symfony docs for more details.')
  1569.                                     ->example(['\Pimcore\Model\DataObject\Product'])
  1570.                                 ->end()
  1571.                                 ->arrayNode('support_strategy')
  1572.                                     ->fixXmlConfig('argument')
  1573.                                     ->children()
  1574.                                         ->enumNode('type')
  1575.                                             ->values(['expression'])
  1576.                                             ->info('Type "expression": a symfony expression to define a criteria.')
  1577.                                         ->end()
  1578.                                         ->arrayNode('arguments')
  1579.                                             ->beforeNormalization()
  1580.                                                 ->ifString()
  1581.                                                 ->then(function ($v) {
  1582.                                                     return [$v];
  1583.                                                 })
  1584.                                             ->end()
  1585.                                             ->requiresAtLeastOneElement()
  1586.                                             ->prototype('variable')
  1587.                                             ->end()
  1588.                                         ->end()
  1589.                                         ->scalarNode('service')
  1590.                                             ->cannotBeEmpty()
  1591.                                             ->info('Define a custom service to handle the logic. Take a look at the Symfony docs for more details.')
  1592.                                         ->end()
  1593.                                     ->end()
  1594.                                     ->validate()
  1595.                                         ->ifTrue(function ($v) {
  1596.                                             return isset($v['type']) && isset($v['service']);
  1597.                                         })
  1598.                                         ->thenInvalid('"type" and "service" cannot be used together.')
  1599.                                     ->end()
  1600.                                     ->validate()
  1601.                                         ->ifTrue(function ($v) {
  1602.                                             return !empty($v['arguments']) && isset($v['service']);
  1603.                                         })
  1604.                                         ->thenInvalid('"arguments" and "service" cannot be used together.')
  1605.                                     ->end()
  1606.                                     ->info('Can be used to implement a special logic which subjects are supported by the workflow. For example only products matching certain criteria.')
  1607.                                     ->example([
  1608.                                         'type' => 'expression',
  1609.                                         'arguments' => [
  1610.                                             '\Pimcore\Model\DataObject\Product',
  1611.                                             'subject.getProductType() == "article" and is_fully_authenticated() and "ROLE_PIMCORE_ADMIN" in roles',
  1612.                                         ],
  1613.                                     ])
  1614.                                 ->end()
  1615.                                 ->arrayNode('initial_markings')
  1616.                                     ->info('Can be used to set the initial places (markings) for a workflow. Note that this option is Symfony 4.3+ only')
  1617.                                     ->beforeNormalization()
  1618.                                         ->ifString()
  1619.                                             ->then(function ($v) {
  1620.                                                 return [$v];
  1621.                                             })
  1622.                                         ->end()
  1623.                                         ->requiresAtLeastOneElement()
  1624.                                         ->prototype('scalar')
  1625.                                         ->cannotBeEmpty()
  1626.                                     ->end()
  1627.                                 ->end()
  1628.                                 ->arrayNode('places')
  1629.                                     ->prototype('array')
  1630.                                         ->children()
  1631.                                             ->scalarNode('label')->info('Nice name which will be used in the Pimcore backend.')->end()
  1632.                                             ->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()
  1633.                                             ->scalarNode('color')->info('Color of the place which will be used in the Pimcore backend.')->defaultValue('#bfdadc')->end()
  1634.                                             ->booleanNode('colorInverted')->info('If set to true the color will be used as border and font color otherwise as background color.')->defaultFalse()->end()
  1635.                                             ->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()
  1636.                                             ->arrayNode('permissions')
  1637.                                                 ->prototype('array')
  1638.                                                     ->children()
  1639.                                                         ->scalarNode('condition')->info('A symfony expression can be configured here. The first set of permissions which are matching the condition will be used.')->end()
  1640.                                                         ->booleanNode('save')->info('save permission as it can be configured in Pimcore workplaces')->end()
  1641.                                                         ->booleanNode('publish')->info('publish permission as it can be configured in Pimcore workplaces')->end()
  1642.                                                         ->booleanNode('unpublish')->info('unpublish permission as it can be configured in Pimcore workplaces')->end()
  1643.                                                         ->booleanNode('delete')->info('delete permission as it can be configured in Pimcore workplaces')->end()
  1644.                                                         ->booleanNode('rename')->info('rename permission as it can be configured in Pimcore workplaces')->end()
  1645.                                                         ->booleanNode('view')->info('view permission as it can be configured in Pimcore workplaces')->end()
  1646.                                                         ->booleanNode('settings')->info('settings permission as it can be configured in Pimcore workplaces')->end()
  1647.                                                         ->booleanNode('versions')->info('versions permission as it can be configured in Pimcore workplaces')->end()
  1648.                                                         ->booleanNode('properties')->info('properties permission as it can be configured in Pimcore workplaces')->end()
  1649.                                                         ->booleanNode('modify')->info('a short hand for save, publish, unpublish, delete + rename')->end()
  1650.                                                         ->scalarNode('objectLayout')->info('if set, the user will see the configured custom data object layout')->end()
  1651.                                                     ->end()
  1652.                                                 ->end()
  1653.                                             ->end()
  1654.                                         ->end()
  1655.                                     ->end()
  1656.                                     ->beforeNormalization()
  1657.                                         ->always()
  1658.                                         ->then(function ($places) {
  1659.                                             if (!empty($this->placeholders)) {
  1660.                                                 foreach ($places as $name => $place) {
  1661.                                                     $places[$name] = $this->placeholderProcessor->mergePlaceholders($place$this->placeholders);
  1662.                                                 }
  1663.                                             }
  1664.                                             return $places;
  1665.                                         })
  1666.                                     ->end()
  1667.                                     ->example([
  1668.                                         'places' => [
  1669.                                             'closed' => [
  1670.                                                 'label' => 'close product',
  1671.                                                 'permissions' => [
  1672.                                                     [
  1673.                                                         'condition' => "is_fully_authenticated() and 'ROLE_PIMCORE_ADMIN' in roles",
  1674.                                                         'modify' => false,
  1675.                                                     ],
  1676.                                                     [
  1677.                                                         'modify' => false,
  1678.                                                         'objectLayout' => 2,
  1679.                                                     ],
  1680.                                                 ],
  1681.                                             ],
  1682.                                         ],
  1683.                                     ])
  1684.                                 ->end()
  1685.                                 ->arrayNode('transitions')
  1686.                                     ->beforeNormalization()
  1687.                                         ->always()
  1688.                                         ->then(function ($transitions) {
  1689.                                             // It's an indexed array, we let the validation occurs
  1690.                                             if (isset($transitions[0])) {
  1691.                                                 return $transitions;
  1692.                                             }
  1693.                                             foreach ($transitions as $name => $transition) {
  1694.                                                 if (array_key_exists('name', (array) $transition)) {
  1695.                                                     continue;
  1696.                                                 }
  1697.                                                 $transition['name'] = $name;
  1698.                                                 $transitions[$name] = $transition;
  1699.                                             }
  1700.                                             return $transitions;
  1701.                                         })
  1702.                                     ->end()
  1703.                                     ->isRequired()
  1704.                                     ->requiresAtLeastOneElement()
  1705.                                     ->prototype('array')
  1706.                                         ->children()
  1707.                                             ->scalarNode('name')
  1708.                                                 ->isRequired()
  1709.                                                 ->cannotBeEmpty()
  1710.                                             ->end()
  1711.                                             ->scalarNode('guard')
  1712.                                                 ->cannotBeEmpty()
  1713.                                                 ->info('An expression to block the transition')
  1714.                                                 ->example('is_fully_authenticated() and has_role(\'ROLE_JOURNALIST\') and subject.getTitle() == \'My first article\'')
  1715.                                             ->end()
  1716.                                             ->arrayNode('from')
  1717.                                                 ->beforeNormalization()
  1718.                                                     ->ifString()
  1719.                                                     ->then(function ($v) {
  1720.                                                         return [$v];
  1721.                                                     })
  1722.                                                 ->end()
  1723.                                                 ->requiresAtLeastOneElement()
  1724.                                                 ->prototype('scalar')
  1725.                                                     ->cannotBeEmpty()
  1726.                                                 ->end()
  1727.                                             ->end()
  1728.                                             ->arrayNode('to')
  1729.                                                 ->beforeNormalization()
  1730.                                                     ->ifString()
  1731.                                                     ->then(function ($v) {
  1732.                                                         return [$v];
  1733.                                                     })
  1734.                                                 ->end()
  1735.                                                 ->requiresAtLeastOneElement()
  1736.                                                 ->prototype('scalar')
  1737.                                                     ->cannotBeEmpty()
  1738.                                                 ->end()
  1739.                                             ->end()
  1740.                                             ->arrayNode('options')
  1741.                                                 ->children()
  1742.                                                     ->scalarNode('label')->info('Nice name for the Pimcore backend.')->end()
  1743.                                                     ->arrayNode('notes')
  1744.                                                         ->children()
  1745.                                                             ->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()
  1746.                                                             ->booleanNode('commentRequired')->defaultFalse()->info('Set this to true if the comment should be a required field.')->end()
  1747.                                                             ->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()
  1748.                                                             ->scalarNode('commentGetterFn')->info('Can be used for data objects to prefill the comment field with data from the data object.')->end()
  1749.                                                             ->scalarNode('type')->defaultValue('Status update')->info('Set\'s the type string in the saved note.')->end()
  1750.                                                             ->scalarNode('title')->info('An optional alternative "title" for the note, if blank the actions transition result is used.')->end()
  1751.                                                             ->arrayNode('additionalFields')
  1752.                                                                 ->prototype('array')
  1753.                                                                     ->children()
  1754.                                                                         ->scalarNode('name')->isRequired()->info('The technical name used in the input form.')->end()
  1755.                                                                         ->enumNode('fieldType')
  1756.                                                                             ->isRequired()
  1757.                                                                             ->values(['input''numeric''textarea''select''datetime''date''user''checkbox'])
  1758.                                                                             ->info('The data component name/field type.')
  1759.                                                                         ->end()
  1760.                                                                         ->scalarNode('title')->info('The label used by the field')->end()
  1761.                                                                         ->booleanNode('required')->defaultFalse()->info('Whether or not the field is required.')->end()
  1762.                                                                         ->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()
  1763.                                                                         ->arrayNode('fieldTypeSettings')
  1764.                                                                              ->prototype('variable')->end()
  1765.                                                                              ->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.')
  1766.                                                                         ->end()
  1767.                                                                     ->end()
  1768.                                                                 ->end()
  1769.                                                                 ->info('Add additional field to the transition detail window.')
  1770.                                                             ->end()
  1771.                                                             ->arrayNode('customHtml')
  1772.                                                                 ->children()
  1773.                                                                     ->enumNode('position')
  1774.                                                                         ->values(['top''center''bottom'])
  1775.                                                                         ->defaultValue('top')
  1776.                                                                         ->info('Set position of custom HTML inside modal (top, center, bottom).')
  1777.                                                                     ->end()
  1778.                                                                     ->scalarNode('service')
  1779.                                                                         ->cannotBeEmpty()
  1780.                                                                         ->info('Define a custom service for rendering custom HTML within the note modal.')
  1781.                                                                     ->end()
  1782.                                                                 ->end()
  1783.                                                             ->end()
  1784.                                                         ->end()
  1785.                                                     ->end()
  1786.                                                     ->scalarNode('iconClass')->info('Css class to define the icon which will be used in the actions button in the backend.')->end()
  1787.                                                     ->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()
  1788.                                                     ->arrayNode('notificationSettings')
  1789.                                                         ->prototype('array')
  1790.                                                             ->children()
  1791.                                                                 ->scalarNode('condition')->info('A symfony expression can be configured here. All sets of notification which are matching the condition will be used.')->end()
  1792.                                                                 ->arrayNode('notifyUsers')
  1793.                                                                     ->prototype('scalar')
  1794.                                                                         ->cannotBeEmpty()
  1795.                                                                     ->end()
  1796.                                                                     ->info('Send an email notification to a list of users (user names) when the transition get\'s applied')
  1797.                                                                 ->end()
  1798.                                                                 ->arrayNode('notifyRoles')
  1799.                                                                     ->prototype('scalar')
  1800.                                                                         ->cannotBeEmpty()
  1801.                                                                     ->end()
  1802.                                                                     ->info('Send an email notification to a list of user roles (role names) when the transition get\'s applied')
  1803.                                                                 ->end()
  1804.                                                                 ->arrayNode('channelType')
  1805.                                                                     ->requiresAtLeastOneElement()
  1806.                                                                     ->enumPrototype()
  1807.                                                                         ->values([NotificationSubscriber::NOTIFICATION_CHANNEL_MAILNotificationSubscriber::NOTIFICATION_CHANNEL_PIMCORE_NOTIFICATION])
  1808.                                                                         ->cannotBeEmpty()
  1809.                                                                         ->defaultValue(NotificationSubscriber::NOTIFICATION_CHANNEL_MAIL)
  1810.                                                                     ->end()
  1811.                                                                     ->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 '".')
  1812.                                                                     ->addDefaultChildrenIfNoneSet()
  1813.                                                                 ->end()
  1814.                                                                 ->enumNode('mailType')
  1815.                                                                     ->values([NotificationSubscriber::MAIL_TYPE_TEMPLATENotificationSubscriber::MAIL_TYPE_DOCUMENT])
  1816.                                                                     ->defaultValue(NotificationSubscriber::MAIL_TYPE_TEMPLATE)
  1817.                                                                     ->info('Type of mail source.')
  1818.                                                                 ->end()
  1819.                                                                 ->scalarNode('mailPath')
  1820.                                                                     ->defaultValue(NotificationSubscriber::DEFAULT_MAIL_TEMPLATE_PATH)
  1821.                                                                     ->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.')
  1822.                                                                 ->end()
  1823.                                                             ->end()
  1824.                                                         ->end()
  1825.                                                     ->end()
  1826.                                                     ->enumNode('changePublishedState')
  1827.                                                         ->values([ChangePublishedStateSubscriber::NO_CHANGEChangePublishedStateSubscriber::FORCE_UNPUBLISHEDChangePublishedStateSubscriber::FORCE_PUBLISHEDChangePublishedStateSubscriber::SAVE_VERSION])
  1828.                                                         ->defaultValue(ChangePublishedStateSubscriber::NO_CHANGE)
  1829.                                                         ->info('Change published state of element while transition (only available for documents and data objects).')
  1830.                                                     ->end()
  1831.                                                 ->end()
  1832.                                             ->end()
  1833.                                         ->end()
  1834.                                     ->end()
  1835.                                     ->example([
  1836.                                         'close_product' => [
  1837.                                             'from' => 'open',
  1838.                                             'to' => 'closed',
  1839.                                             'options' => [
  1840.                                                 'label' => 'close product',
  1841.                                                 'notes' => [
  1842.                                                     'commentEnabled' => true,
  1843.                                                     'commentRequired' => true,
  1844.                                                     'additionalFields' => [
  1845.                                                         [
  1846.                                                             'name' => 'accept',
  1847.                                                             'title' => 'accept terms',
  1848.                                                             'required' => true,
  1849.                                                             'fieldType' => 'checkbox',
  1850.                                                         ],
  1851.                                                         [
  1852.                                                             'name' => 'select',
  1853.                                                             'title' => 'please select a type',
  1854.                                                             'setterFn' => 'setSpecialWorkflowType',
  1855.                                                             'fieldType' => 'select',
  1856.                                                             'fieldTypeSettings' => [
  1857.                                                                 'options' => [
  1858.                                                                     ['key' => 'Option A''value' => 'a'],
  1859.                                                                     ['key' => 'Option B''value' => 'b'],
  1860.                                                                     ['key' => 'Option C''value' => 'c'],
  1861.                                                                 ],
  1862.                                                             ],
  1863.                                                         ],
  1864.                                                     ],
  1865.                                                 ],
  1866.                                             ],
  1867.                                         ],
  1868.                                     ])
  1869.                                 ->end()
  1870.                                 ->arrayNode('globalActions')
  1871.                                     ->prototype('array')
  1872.                                         ->children()
  1873.                                             ->scalarNode('label')->info('Nice name for the Pimcore backend.')->end()
  1874.                                             ->scalarNode('iconClass')->info('Css class to define the icon which will be used in the actions button in the backend.')->end()
  1875.                                             ->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()
  1876.                                             ->scalarNode('guard')
  1877.                                                 ->cannotBeEmpty()
  1878.                                                 ->info('An expression to block the action')
  1879.                                                 ->example('is_fully_authenticated() and has_role(\'ROLE_JOURNALIST\') and subject.getTitle() == \'My first article\'')
  1880.                                             ->end()
  1881.                                             ->arrayNode('to')
  1882.                                                 ->beforeNormalization()
  1883.                                                     ->ifString()
  1884.                                                     ->then(function ($v) {
  1885.                                                         return [$v];
  1886.                                                     })
  1887.                                                 ->end()
  1888.                                                 ->requiresAtLeastOneElement()
  1889.                                                 ->prototype('scalar')
  1890.                                                     ->cannotBeEmpty()
  1891.                                                 ->end()
  1892.                                                 ->info('Optionally set the current place of the workflow. Can be used for example to reset the workflow to the initial place.')
  1893.                                             ->end()
  1894.                                             ->arrayNode('notes')
  1895.                                                 ->children()
  1896.                                                     ->booleanNode('commentEnabled')->defaultFalse()->end()
  1897.                                                     ->booleanNode('commentRequired')->defaultFalse()->end()
  1898.                                                     ->scalarNode('commentSetterFn')->end()
  1899.                                                     ->scalarNode('commentGetterFn')->end()
  1900.                                                     ->scalarNode('type')->defaultValue('Status update')->end()
  1901.                                                     ->scalarNode('title')->end()
  1902.                                                     ->arrayNode('additionalFields')
  1903.                                                         ->prototype('array')
  1904.                                                             ->children()
  1905.                                                                 ->scalarNode('name')->isRequired()->end()
  1906.                                                                 ->enumNode('fieldType')
  1907.                                                                     ->isRequired()
  1908.                                                                     ->values(['input''textarea''select''datetime''date''user''checkbox'])
  1909.                                                                 ->end()
  1910.                                                                 ->scalarNode('title')->end()
  1911.                                                                 ->booleanNode('required')->defaultFalse()->end()
  1912.                                                                 ->scalarNode('setterFn')->end()
  1913.                                                                 ->arrayNode('fieldTypeSettings')
  1914.                                                                      ->prototype('variable')->end()
  1915.                                                                 ->end()
  1916.                                                             ->end()
  1917.                                                         ->end()
  1918.                                                     ->end()
  1919.                                                     ->arrayNode('customHtml')
  1920.                                                         ->children()
  1921.                                                             ->enumNode('position')
  1922.                                                                 ->values(['top''center''bottom'])
  1923.                                                                 ->defaultValue('top')
  1924.                                                                 ->info('Set position of custom HTML inside modal (top, center, bottom).')
  1925.                                                             ->end()
  1926.                                                             ->scalarNode('service')
  1927.                                                                 ->cannotBeEmpty()
  1928.                                                                 ->info('Define a custom service for rendering custom HTML within the note modal.')
  1929.                                                             ->end()
  1930.                                                         ->end()
  1931.                                                     ->end()
  1932.                                                 ->end()
  1933.                                                 ->info('See notes section of transitions. It works exactly the same way.')
  1934.                                             ->end()
  1935.                                         ->end()
  1936.                                     ->end()
  1937.                                     ->info('Actions which will be added to actions button independently of the current workflow place.')
  1938.                                 ->end()
  1939.                             ->end()
  1940.                             ->validate()
  1941.                                 ->ifTrue(function ($v) {
  1942.                                     return $v['supports'] && isset($v['support_strategy']);
  1943.                                 })
  1944.                                 ->thenInvalid('"supports" and "support_strategy" cannot be used together.')
  1945.                             ->end()
  1946.                             ->validate()
  1947.                                 ->ifTrue(function ($v) {
  1948.                                     return !$v['supports'] && !isset($v['support_strategy']);
  1949.                                 })
  1950.                                 ->thenInvalid('"supports" or "support_strategy" should be configured.')
  1951.                             ->end()
  1952.                             ->validate()
  1953.                                 ->ifTrue(function ($v) {
  1954.                                     if (($v['type'] ?? 'workflow') === 'state_machine') {
  1955.                                         foreach ($v['transitions'] ?? [] as $transition) {
  1956.                                             if (count($transition['to']) > 1) {
  1957.                                                 return true;
  1958.                                             }
  1959.                                         }
  1960.                                         foreach ($v['globalActions'] ?? [] as $transition) {
  1961.                                             if (count($transition['to']) > 1) {
  1962.                                                 return true;
  1963.                                             }
  1964.                                         }
  1965.                                     }
  1966.                                     return false;
  1967.                                 })
  1968.                                 ->thenInvalid('Type `state_machine` does not support multiple `to` definitions for transitions and global actions. Change definition or type to `workflow`.')
  1969.                             ->end()
  1970.                         ->end()
  1971.                     ->end()
  1972.                 ->end()
  1973.                 ->addDefaultsIfNotSet()
  1974.             ->end();
  1975.     }
  1976.     /**
  1977.      * Add predefined properties specific extension config
  1978.      *
  1979.      * @param ArrayNodeDefinition $rootNode
  1980.      */
  1981.     private function addPredefinedPropertiesNode(ArrayNodeDefinition $rootNode)
  1982.     {
  1983.         $predefinedPropertiesNode $rootNode
  1984.             ->children()
  1985.             ->arrayNode('properties')
  1986.             ->ignoreExtraKeys()
  1987.             ->addDefaultsIfNotSet();
  1988.         $predefinedPropertiesNode
  1989.         ->children()
  1990.             ->arrayNode('predefined')
  1991.                 ->addDefaultsIfNotSet()
  1992.                 ->children()
  1993.                     ->arrayNode('definitions')
  1994.                     ->normalizeKeys(false)
  1995.                         ->prototype('array')
  1996.                             ->children()
  1997.                                 ->scalarNode('name')->end()
  1998.                                 ->scalarNode('description')->end()
  1999.                                 ->scalarNode('key')->end()
  2000.                                 ->scalarNode('type')->end()
  2001.                                 ->scalarNode('data')->end()
  2002.                                 ->scalarNode('config')->end()
  2003.                                 ->scalarNode('ctype')->end()
  2004.                                 ->booleanNode('inheritable')
  2005.                                     ->beforeNormalization()
  2006.                                         ->ifString()
  2007.                                         ->then(function ($v) {
  2008.                                             return (bool)$v;
  2009.                                         })
  2010.                                         ->end()
  2011.                                 ->end()
  2012.                                 ->integerNode('creationDate')->end()
  2013.                                 ->integerNode('modificationDate')->end()
  2014.                             ->end()
  2015.                         ->end()
  2016.                     ->end()
  2017.                 ->end()
  2018.             ->end()
  2019.         ->end();
  2020.     }
  2021.     /**
  2022.      * Add static routes specific extension config
  2023.      *
  2024.      * @param ArrayNodeDefinition $rootNode
  2025.      */
  2026.     private function addStaticroutesNode(ArrayNodeDefinition $rootNode)
  2027.     {
  2028.         $rootNode
  2029.         ->children()
  2030.             ->arrayNode('staticroutes')
  2031.                 ->ignoreExtraKeys()
  2032.                 ->addDefaultsIfNotSet()
  2033.                 ->children()
  2034.                     ->arrayNode('definitions')
  2035.                     ->normalizeKeys(false)
  2036.                         ->prototype('array')
  2037.                             ->children()
  2038.                                 ->scalarNode('name')->end()
  2039.                                 ->scalarNode('pattern')->end()
  2040.                                 ->scalarNode('reverse')->end()
  2041.                                 ->scalarNode('controller')->end()
  2042.                                 ->scalarNode('variables')->end()
  2043.                                 ->scalarNode('defaults')->end()
  2044.                                 ->arrayNode('siteId')
  2045.                                     ->integerPrototype()->end()
  2046.                                 ->end()
  2047.                                 ->arrayNode('methods')
  2048.                                     ->scalarPrototype()->end()
  2049.                                 ->end()
  2050.                                 ->integerNode('priority')->end()
  2051.                                 ->integerNode('creationDate')->end()
  2052.                                 ->integerNode('modificationDate')->end()
  2053.                             ->end()
  2054.                         ->end()
  2055.                     ->end()
  2056.                 ->end()
  2057.             ->end()
  2058.         ->end();
  2059.     }
  2060.     /**
  2061.      * Add perspectives specific extension config
  2062.      *
  2063.      * @param ArrayNodeDefinition $rootNode
  2064.      */
  2065.     private function addPerspectivesNode(ArrayNodeDefinition $rootNode)
  2066.     {
  2067.         $rootNode
  2068.             ->children()
  2069.                 ->arrayNode('perspectives')
  2070.                     ->ignoreExtraKeys()
  2071.                     ->addDefaultsIfNotSet()
  2072.                     ->children()
  2073.                         ->arrayNode('definitions')
  2074.                         ->normalizeKeys(false)
  2075.                             ->prototype('array')
  2076.                                 ->children()
  2077.                                     ->scalarNode('iconCls')->end()
  2078.                                     ->scalarNode('icon')->end()
  2079.                                     ->variableNode('toolbar')->end()
  2080.                                     ->arrayNode('dashboards')
  2081.                                         ->children()
  2082.                                             ->variableNode('predefined')->end()
  2083.                                         ->end()
  2084.                                     ->end()
  2085.                                     ->arrayNode('elementTree')
  2086.                                         ->prototype('array')
  2087.                                             ->children()
  2088.                                                 ->scalarNode('type')->end()
  2089.                                                 ->scalarNode('position')->end()
  2090.                                                 ->scalarNode('name')->end()
  2091.                                                 ->booleanNode('expanded')->end()
  2092.                                                 ->scalarNode('hidden')->end()
  2093.                                                 ->integerNode('sort')->end()
  2094.                                                 ->scalarNode('id')->end()
  2095.                                                 ->variableNode('treeContextMenu')->end()
  2096.                                             ->end()
  2097.                                         ->end()
  2098.                                     ->end()
  2099.                                 ->end()
  2100.                             ->end()
  2101.                         ->end()
  2102.                     ->end()
  2103.                 ->end()
  2104.             ->end()
  2105.         ->end();
  2106.     }
  2107.     /**
  2108.      * Add custom views specific extension config
  2109.      *
  2110.      * @param ArrayNodeDefinition $rootNode
  2111.      */
  2112.     private function addCustomViewsNode(ArrayNodeDefinition $rootNode)
  2113.     {
  2114.         $rootNode
  2115.             ->children()
  2116.                 ->arrayNode('custom_views')
  2117.                     ->ignoreExtraKeys()
  2118.                     ->addDefaultsIfNotSet()
  2119.                     ->children()
  2120.                         ->arrayNode('definitions')
  2121.                         ->normalizeKeys(false)
  2122.                             ->prototype('array')
  2123.                             ->children()
  2124.                                 ->scalarNode('id')->end()
  2125.                                 ->scalarNode('treetype')->end()
  2126.                                 ->scalarNode('name')->end()
  2127.                                 ->scalarNode('condition')->end()
  2128.                                 ->scalarNode('icon')->end()
  2129.                                 ->scalarNode('rootfolder')->end()
  2130.                                 ->scalarNode('showroot')->end()
  2131.                                 ->variableNode('classes')->end()
  2132.                                 ->scalarNode('position')->end()
  2133.                                 ->scalarNode('sort')->end()
  2134.                                 ->booleanNode('expanded')->end()
  2135.                                 ->scalarNode('having')->end()
  2136.                                 ->scalarNode('where')->end()
  2137.                                 ->variableNode('treeContextMenu')->end()
  2138.                                 ->arrayNode('joins')
  2139.                                     ->protoType('array')
  2140.                                         ->children()
  2141.                                             ->scalarNode('type')->end()
  2142.                                             ->scalarNode('condition')->end()
  2143.                                             ->variableNode('name')->end()
  2144.                                             ->variableNode('columns')->end()
  2145.                                         ->end()
  2146.                                     ->end()
  2147.                                 ->end()
  2148.                             ->end()
  2149.                         ->end()
  2150.                     ->end()
  2151.                 ->end()
  2152.             ->end();
  2153.     }
  2154. }