vendor/sylius/mailer-bundle/src/Bundle/DependencyInjection/Configuration.php line 59

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of the Sylius package.
  4. *
  5. * (c) Paweł Jędrzejewski
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. declare(strict_types=1);
  11. namespace Sylius\Bundle\MailerBundle\DependencyInjection;
  12. use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
  13. use Symfony\Component\Config\Definition\Builder\TreeBuilder;
  14. use Symfony\Component\Config\Definition\ConfigurationInterface;
  15. final class Configuration implements ConfigurationInterface
  16. {
  17. /**
  18. * {@inheritdoc}
  19. */
  20. public function getConfigTreeBuilder(): TreeBuilder
  21. {
  22. $treeBuilder = new TreeBuilder('sylius_mailer');
  23. /** @var ArrayNodeDefinition $rootNode */
  24. $rootNode = $treeBuilder->getRootNode();
  25. $rootNode
  26. ->children()
  27. ->scalarNode('sender_adapter')->end()
  28. ->scalarNode('renderer_adapter')->end()
  29. ->end()
  30. ;
  31. $this->addEmailsSection($rootNode);
  32. return $treeBuilder;
  33. }
  34. private function addEmailsSection(ArrayNodeDefinition $node): void
  35. {
  36. $node
  37. ->children()
  38. ->arrayNode('sender')
  39. ->addDefaultsIfNotSet()
  40. ->children()
  41. ->scalarNode('name')->defaultValue('Example.com Store')->end()
  42. ->scalarNode('address')->defaultValue('no-reply@example.com')->end()
  43. ->end()
  44. ->end()
  45. ->arrayNode('emails')
  46. ->useAttributeAsKey('code')
  47. ->arrayPrototype()
  48. ->children()
  49. ->scalarNode('subject')
  50. ->setDeprecated('The "subject" option is deprecated since SyliusMailerBundle 1.5')
  51. ->end()
  52. ->scalarNode('template')->cannotBeEmpty()->end()
  53. ->booleanNode('enabled')->defaultTrue()->end()
  54. ->arrayNode('sender')
  55. ->children()
  56. ->scalarNode('name')->end()
  57. ->scalarNode('address')->end()
  58. ->end()
  59. ->end()
  60. ->end()
  61. ->end()
  62. ->end()
  63. ->arrayNode('templates')
  64. ->setDeprecated('The "templates" option is deprecated')
  65. ->useAttributeAsKey('name')
  66. ->scalarPrototype()->end()
  67. ->end()
  68. ->end()
  69. ;
  70. }
  71. }