DumbStep.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Bundle\WebConfiguratorBundle\Step;
  11. use Symfony\Component\Form\FormContext;
  12. use Symfony\Bundle\WebConfiguratorBundle\Form\DoctrineForm;
  13. use Symfony\Bundle\WebConfiguratorBundle\Exception\StepRequirementException;
  14. /**
  15. * Csrf Step.
  16. *
  17. * @author Marc Weistroff <marc.weistroff@sensio.com>
  18. */
  19. class CsrfStep implements StepInterface
  20. {
  21. /**
  22. * @validation:NotBlank
  23. */
  24. public $csrf_secret;
  25. public function __construct(array $parameters)
  26. {
  27. $this->csrf_secret = $parameters['csrf_secret'];
  28. }
  29. /**
  30. * @see StepInterface
  31. */
  32. public function getName()
  33. {
  34. return 'CSRF';
  35. }
  36. /**
  37. * @see StepInterface
  38. */
  39. public function getForm(FormContext $context)
  40. {
  41. return CsrfForm::create($context, 'config');
  42. }
  43. /**
  44. * @see StepInterface
  45. */
  46. public function checkRequirements()
  47. {
  48. }
  49. /**
  50. * @see StepInterface
  51. */
  52. public function update(StepInterface $data)
  53. {
  54. return array('csrf_secret' => $data->csrf_secret);
  55. }
  56. /**
  57. * @see StepInterface
  58. */
  59. public function getTemplate()
  60. {
  61. return 'SymfonyWebConfiguratorBundle:Step:csrf.html.twig';
  62. }
  63. }