vendor/friendsofsymfony/comment-bundle/DependencyInjection/Configuration.php line 35

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the FOSCommentBundle package.
  4.  *
  5.  * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
  6.  *
  7.  * This source file is subject to the MIT license that is bundled
  8.  * with this source code in the file LICENSE.
  9.  */
  10. namespace FOS\CommentBundle\DependencyInjection;
  11. use FOS\CommentBundle\Util\LegacyFormHelper;
  12. use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  13. use Symfony\Component\Config\Definition\ConfigurationInterface;
  14. /**
  15.  * This class contains the configuration information for the bundle.
  16.  *
  17.  * This information is solely responsible for how the different configuration
  18.  * sections are normalized, and merged.
  19.  */
  20. class Configuration implements ConfigurationInterface
  21. {
  22.     /**
  23.      * Generates the configuration tree.
  24.      *
  25.      * @return NodeInterface
  26.      */
  27.     public function getConfigTreeBuilder()
  28.     {
  29.         $treeBuilder = new TreeBuilder();
  30.         $treeBuilder->root('fos_comment')
  31.             ->children()
  32.                 ->scalarNode('db_driver')->cannotBeOverwritten()->isRequired()->end()
  33.                 ->scalarNode('model_manager_name')->defaultNull()->end()
  34.                 ->arrayNode('form')->addDefaultsIfNotSet()
  35.                     ->children()
  36.                         ->arrayNode('comment')->addDefaultsIfNotSet()
  37.                             ->children()
  38.                                 ->scalarNode('type')->defaultValue(LegacyFormHelper::getType('FOS\CommentBundle\Form\CommentType'))->end()
  39.                                 ->scalarNode('name')->defaultValue('fos_comment_comment')->end()
  40.                             ->end()
  41.                         ->end()
  42.                         ->arrayNode('thread')->addDefaultsIfNotSet()
  43.                             ->children()
  44.                                 ->scalarNode('type')->defaultValue(LegacyFormHelper::getType('FOS\CommentBundle\Form\ThreadType'))->end()
  45.                                 ->scalarNode('name')->defaultValue('fos_comment_thread')->end()
  46.                             ->end()
  47.                         ->end()
  48.                         ->arrayNode('commentable_thread')->addDefaultsIfNotSet()
  49.                             ->children()
  50.                                 ->scalarNode('type')->defaultValue(LegacyFormHelper::getType('FOS\CommentBundle\Form\CommentableThreadType'))->end()
  51.                                 ->scalarNode('name')->defaultValue('fos_comment_commentable_thread')->end()
  52.                             ->end()
  53.                         ->end()
  54.                         ->arrayNode('delete_comment')->addDefaultsIfNotSet()
  55.                             ->children()
  56.                                 ->scalarNode('type')->defaultValue(LegacyFormHelper::getType('FOS\CommentBundle\Form\DeleteCommentType'))->end()
  57.                                 ->scalarNode('name')->defaultValue('fos_comment_delete_comment')->end()
  58.                             ->end()
  59.                         ->end()
  60.                         ->arrayNode('vote')->addDefaultsIfNotSet()
  61.                             ->children()
  62.                                 ->scalarNode('type')->defaultValue(LegacyFormHelper::getType('FOS\CommentBundle\Form\VoteType'))->end()
  63.                                 ->scalarNode('name')->defaultValue('fos_comment_vote')->end()
  64.                             ->end()
  65.                         ->end()
  66.                     ->end()
  67.                 ->end()
  68.                 ->arrayNode('class')->isRequired()
  69.                     ->children()
  70.                         ->arrayNode('model')->isRequired()
  71.                             ->children()
  72.                                 ->scalarNode('comment')->isRequired()->end()
  73.                                 ->scalarNode('thread')->isRequired()->end()
  74.                                 ->scalarNode('vote')->end()
  75.                             ->end()
  76.                         ->end()
  77.                     ->end()
  78.                 ->end()
  79.                 ->arrayNode('acl')->end()
  80.                 ->arrayNode('acl_roles')->addDefaultsIfNotSet()
  81.                     ->children()
  82.                         ->arrayNode('comment')->addDefaultsIfNotSet()
  83.                             ->children()
  84.                                 ->scalarNode('create')->cannotBeEmpty()->defaultValue('IS_AUTHENTICATED_ANONYMOUSLY')->end()
  85.                                 ->scalarNode('view')->cannotBeEmpty()->defaultValue('IS_AUTHENTICATED_ANONYMOUSLY')->end()
  86.                                 ->scalarNode('edit')->cannotBeEmpty()->defaultValue('ROLE_ADMIN')->end()
  87.                                 ->scalarNode('delete')->cannotBeEmpty()->defaultValue('ROLE_ADMIN')->end()
  88.                             ->end()
  89.                         ->end()
  90.                         ->arrayNode('thread')->addDefaultsIfNotSet()
  91.                             ->children()
  92.                                 ->scalarNode('create')->cannotBeEmpty()->defaultValue('IS_AUTHENTICATED_ANONYMOUSLY')->end()
  93.                                 ->scalarNode('view')->cannotBeEmpty()->defaultValue('IS_AUTHENTICATED_ANONYMOUSLY')->end()
  94.                                 ->scalarNode('edit')->cannotBeEmpty()->defaultValue('ROLE_ADMIN')->end()
  95.                                 ->scalarNode('delete')->cannotBeEmpty()->defaultValue('ROLE_ADMIN')->end()
  96.                             ->end()
  97.                         ->end()
  98.                         ->arrayNode('vote')->addDefaultsIfNotSet()
  99.                             ->children()
  100.                                 ->scalarNode('create')->cannotBeEmpty()->defaultValue('IS_AUTHENTICATED_ANONYMOUSLY')->end()
  101.                                 ->scalarNode('view')->cannotBeEmpty()->defaultValue('IS_AUTHENTICATED_ANONYMOUSLY')->end()
  102.                                 ->scalarNode('edit')->cannotBeEmpty()->defaultValue('ROLE_ADMIN')->end()
  103.                                 ->scalarNode('delete')->cannotBeEmpty()->defaultValue('ROLE_ADMIN')->end()
  104.                             ->end()
  105.                         ->end()
  106.                     ->end()
  107.                 ->end()
  108.                 ->arrayNode('template')
  109.                     ->addDefaultsIfNotSet()
  110.                     ->children()
  111.                         ->scalarNode('engine')->defaultValue('twig')->end()
  112.                     ->end()
  113.                 ->end()
  114.                 ->arrayNode('service')->addDefaultsIfNotSet()
  115.                     ->children()
  116.                         ->arrayNode('manager')->addDefaultsIfNotSet()
  117.                             ->children()
  118.                                 ->scalarNode('comment')->cannotBeEmpty()->defaultValue('fos_comment.manager.comment.default')->end()
  119.                                 ->scalarNode('thread')->cannotBeEmpty()->defaultValue('fos_comment.manager.thread.default')->end()
  120.                                 ->scalarNode('vote')->cannotBeEmpty()->defaultValue('fos_comment.manager.vote.default')->end()
  121.                             ->end()
  122.                         ->end()
  123.                         ->arrayNode('acl')->addDefaultsIfNotSet()
  124.                             ->children()
  125.                                 ->scalarNode('comment')->cannotBeEmpty()->defaultValue('fos_comment.acl.comment.security')->end()
  126.                                 ->scalarNode('thread')->cannotBeEmpty()->defaultValue('fos_comment.acl.thread.security')->end()
  127.                                 ->scalarNode('vote')->cannotBeEmpty()->defaultValue('fos_comment.acl.vote.security')->end()
  128.                             ->end()
  129.                         ->end()
  130.                         ->arrayNode('form_factory')->addDefaultsIfNotSet()
  131.                             ->children()
  132.                                 ->scalarNode('comment')->cannotBeEmpty()->defaultValue('fos_comment.form_factory.comment.default')->end()
  133.                                 ->scalarNode('commentable_thread')->cannotBeEmpty()->defaultValue('fos_comment.form_factory.commentable_thread.default')->end()
  134.                                 ->scalarNode('delete_comment')->cannotBeEmpty()->defaultValue('fos_comment.form_factory.delete_comment.default')->end()
  135.                                 ->scalarNode('thread')->cannotBeEmpty()->defaultValue('fos_comment.form_factory.thread.default')->end()
  136.                                 ->scalarNode('vote')->cannotBeEmpty()->defaultValue('fos_comment.form_factory.vote.default')->end()
  137.                             ->end()
  138.                         ->end()
  139.                         ->arrayNode('spam_detection')
  140.                             ->children()
  141.                                 ->scalarNode('comment')->end()
  142.                             ->end()
  143.                         ->end()
  144.                         ->arrayNode('sorting')->addDefaultsIfNotSet()
  145.                             ->children()
  146.                                 ->scalarNode('default')->cannotBeEmpty()->defaultValue('date_desc')->end()
  147.                             ->end()
  148.                         ->end()
  149.                         ->scalarNode('markup')->end()
  150.                     ->end()
  151.                 ->end()
  152.             ->end()
  153.         ->end();
  154.         return $treeBuilder;
  155.     }
  156. }