vendor/pimcore/pimcore/bundles/AdminBundle/DependencyInjection/Configuration.php line 31

Open in your IDE?
  1. <?php
  2. /**
  3.  * Pimcore
  4.  *
  5.  * This source file is available under two different licenses:
  6.  * - GNU General Public License version 3 (GPLv3)
  7.  * - Pimcore Enterprise License (PEL)
  8.  * Full copyright and license information is available in
  9.  * LICENSE.md which is distributed with this source code.
  10.  *
  11.  * @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  12.  * @license    http://www.pimcore.org/license     GPLv3 and PEL
  13.  */
  14. namespace Pimcore\Bundle\AdminBundle\DependencyInjection;
  15. use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
  16. use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  17. use Symfony\Component\Config\Definition\ConfigurationInterface;
  18. /**
  19.  * Adds configuration for gdpr data provider
  20.  */
  21. class Configuration implements ConfigurationInterface
  22. {
  23.     /**
  24.      * {@inheritdoc}
  25.      */
  26.     public function getConfigTreeBuilder()
  27.     {
  28.         $treeBuilder = new TreeBuilder();
  29.         $rootNode $treeBuilder->root('pimcore_admin');
  30.         $rootNode->append($this->buildGdprDataExtractorNode());
  31.         $rootNode->append($this->buildObjectsNode());
  32.         $rootNode->append($this->buildAssetsNode());
  33.         $rootNode->append($this->buildDocumentsNode());
  34.         $rootNode->children()
  35.             ->arrayNode('admin_languages')
  36.                 ->prototype('scalar')
  37.                 ->end()
  38.             ->end()
  39.             ->arrayNode('csrf_protection')
  40.                 ->addDefaultsIfNotSet()
  41.                 ->children()
  42.                     ->arrayNode('excluded_routes')
  43.                         ->prototype('scalar')
  44.                         ->end()
  45.                     ->end()
  46.                 ->end()
  47.             ->end()
  48.             ->scalarNode('custom_admin_path_identifier')
  49.                 ->defaultNull()
  50.                 ->validate()
  51.                     ->ifTrue(function ($v) {
  52.                         return strlen($v) < 20;
  53.                     })
  54.                     ->thenInvalid('custom_admin_path_identifier must be at least 20 characters long')
  55.                 ->end()
  56.             ->end()
  57.             ->arrayNode('branding')
  58.                 ->addDefaultsIfNotSet()
  59.                 ->children()
  60.                     ->booleanNode('login_screen_invert_colors')
  61.                         ->defaultFalse()
  62.                     ->end()
  63.                     ->scalarNode('color_login_screen')
  64.                         ->defaultNull()
  65.                     ->end()
  66.                     ->scalarNode('color_admin_interface')
  67.                         ->defaultNull()
  68.                     ->end()
  69.                     ->scalarNode('login_screen_custom_image')
  70.                         ->defaultNull()
  71.                     ->end()
  72.                 ->end()
  73.             ->end()
  74.         ;
  75.         return $treeBuilder;
  76.     }
  77.     /**
  78.      * @return \Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition|\Symfony\Component\Config\Definition\Builder\NodeDefinition
  79.      */
  80.     protected function buildGdprDataExtractorNode()
  81.     {
  82.         $treeBuilder = new TreeBuilder();
  83.         $gdprDataExtractor $treeBuilder->root('gdpr_data_extractor');
  84.         $gdprDataExtractor->addDefaultsIfNotSet();
  85.         $dataObjects $treeBuilder->root('dataObjects');
  86.         $dataObjects
  87.             ->addDefaultsIfNotSet()
  88.             ->info('Settings for DataObjects DataProvider');
  89.         $dataObjects
  90.             ->children()
  91.                 ->arrayNode('classes')
  92.                     ->info('Configure which classes should be considered, array key is class name')
  93.                     ->prototype('array')
  94.                         ->info('
  95.     MY_CLASS_NAME: 
  96.         include: true
  97.         allowDelete: false
  98.         includedRelations:
  99.             - manualSegemens
  100.             - calculatedSegments
  101.                         ')
  102.                         ->children()
  103.                             ->booleanNode('include')
  104.                                 ->info('Set if class should be considered in export.')
  105.                                 ->defaultTrue()
  106.                             ->end()
  107.                             ->booleanNode('allowDelete')
  108.                                 ->info('Allow delete of objects directly in preview grid.')
  109.                                 ->defaultFalse()
  110.                             ->end()
  111.                             ->arrayNode('includedRelations')
  112.                                 ->info('List relation attributes that should be included recursively into export.')
  113.                                 ->prototype('scalar')->end()
  114.                             ->end()
  115.                         ->end()
  116.                     ->end()
  117.                 ->end()
  118.             ->end()
  119.         ;
  120.         $gdprDataExtractor->append($dataObjects);
  121.         $assets $treeBuilder->root('assets');
  122.         $assets
  123.             ->addDefaultsIfNotSet()
  124.             ->info('Settings for Assets DataProvider');
  125.         $assets
  126.             ->children()
  127.                 ->arrayNode('types')
  128.                     ->info('Configure which types should be considered')
  129.                     ->prototype('array')
  130.                     ->info('asset types')
  131.                 ->end()->defaultValue([])
  132.             ->end();
  133.         $gdprDataExtractor->append($assets);
  134.         return $gdprDataExtractor;
  135.     }
  136.     /**
  137.      * @return ArrayNodeDefinition|\Symfony\Component\Config\Definition\Builder\NodeDefinition
  138.      */
  139.     protected function buildEventsNode()
  140.     {
  141.         $treeBuilder = new TreeBuilder();
  142.         $notesEvents $treeBuilder->root('notes_events');
  143.         $notesEvents
  144.             ->addDefaultsIfNotSet()
  145.             ->children()
  146.                 ->arrayNode('types')
  147.                     ->info('List all notes/event types.')
  148.                     ->prototype('scalar')->end()
  149.                     ->defaultValue(['''content''seo''warning''notice'])
  150.                 ->end()
  151.             ->end()
  152.         ;
  153.         return $notesEvents;
  154.     }
  155.     /**
  156.      * @return ArrayNodeDefinition|\Symfony\Component\Config\Definition\Builder\NodeDefinition
  157.      */
  158.     protected function buildObjectsNode()
  159.     {
  160.         $treeBuilder = new TreeBuilder();
  161.         $objectsNode $treeBuilder->root('objects');
  162.         $objectsNode
  163.             ->addDefaultsIfNotSet()
  164.             ->append($this->buildEventsNode());
  165.         return $objectsNode;
  166.     }
  167.     /**
  168.      * @return ArrayNodeDefinition|\Symfony\Component\Config\Definition\Builder\NodeDefinition
  169.      */
  170.     protected function buildAssetsNode()
  171.     {
  172.         $treeBuilder = new TreeBuilder();
  173.         $assetsNode $treeBuilder->root('assets');
  174.         $assetsNode
  175.             ->addDefaultsIfNotSet()
  176.             ->append($this->buildEventsNode());
  177.         return $assetsNode;
  178.     }
  179.     /**
  180.      * @return ArrayNodeDefinition|\Symfony\Component\Config\Definition\Builder\NodeDefinition
  181.      */
  182.     protected function buildDocumentsNode()
  183.     {
  184.         $treeBuilder = new TreeBuilder();
  185.         $documentsNode $treeBuilder->root('documents');
  186.         $documentsNode
  187.             ->addDefaultsIfNotSet()
  188.             ->append($this->buildEventsNode());
  189.         return $documentsNode;
  190.     }
  191. }