vendor/stefandoorn/sitemap-plugin/src/DependencyInjection/Configuration.php line 19

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace SitemapPlugin\DependencyInjection;
  4. use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
  5. use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  6. use Symfony\Component\Config\Definition\ConfigurationInterface;
  7. final class Configuration implements ConfigurationInterface
  8. {
  9.     /**
  10.      * @return TreeBuilder
  11.      */
  12.     public function getConfigTreeBuilder()
  13.     {
  14.         $treeBuilder = new TreeBuilder();
  15.         $rootNode $treeBuilder->root('sylius_sitemap');
  16.         $this->addSitemapSection($rootNode);
  17.         return $treeBuilder;
  18.     }
  19.     private function addSitemapSection(ArrayNodeDefinition $node): void
  20.     {
  21.         $node
  22.             ->children()
  23.                 ->arrayNode('providers')
  24.                     ->addDefaultsIfNotSet()
  25.                     ->children()
  26.                         ->booleanNode('products')->defaultTrue()->end()
  27.                         ->booleanNode('taxons')->defaultTrue()->end()
  28.                         ->booleanNode('static')->defaultTrue()->end()
  29.                     ->end()
  30.                 ->end()
  31.                 ->scalarNode('template')
  32.                     ->defaultValue('@SitemapPlugin/show.xml.twig')
  33.                 ->end()
  34.                 ->scalarNode('index_template')
  35.                     ->defaultValue('@SitemapPlugin/index.xml.twig')
  36.                 ->end()
  37.                 ->scalarNode('exclude_taxon_root')
  38.                     ->info('Often you don\'t want to include the root of your taxon tree as it has a generic name as \'products\'.')
  39.                     ->defaultTrue()
  40.                 ->end()
  41.                 ->scalarNode('absolute_url')
  42.                     ->info('Whether to generate absolute URL\'s (true) or relative (false). Defaults to true.')
  43.                     ->defaultTrue()
  44.                 ->end()
  45.                 ->scalarNode('hreflang')
  46.                     ->info('Whether to generate alternative URL versions for each locale. Defaults to true. Background: https://support.google.com/webmasters/answer/189077?hl=en.')
  47.                     ->defaultTrue()
  48.                 ->end()
  49.                 ->arrayNode('static_routes')
  50.                     ->beforeNormalization()->castToArray()->end()
  51.                     ->info('In case you want to add static routes to your sitemap (e.g. homepage), configure them here. Defaults to homepage & contact page.')
  52.                     ->prototype('array')
  53.                         ->children()
  54.                             ->scalarNode('route')
  55.                                 ->info('Name of route')
  56.                                 ->isRequired()
  57.                                 ->cannotBeEmpty()
  58.                             ->end()
  59.                             ->arrayNode('parameters')
  60.                                 ->prototype('variable')->end()
  61.                                 ->info('Add optional parameters to the route.')
  62.                             ->end()
  63.                             ->arrayNode('locales')
  64.                                 ->prototype('scalar')
  65.                                 ->info('Define which locales to add. If empty, it uses the default locales for channel context supplied')
  66.                             ->end()
  67.                         ->end()
  68.                     ->end()
  69.                 ->end()
  70.             ->end();
  71.     }
  72. }