isDefaultCsrfProtectionEnabled() публичный статический Метод

Checks if Csrf protection for all forms is enabled.
public static isDefaultCsrfProtectionEnabled ( )
Пример #1
0
 /**
  * Constructor.
  *
  * @param string $name
  * @param array|object $data
  * @param ValidatorInterface $validator
  * @param array $options
  */
 public function __construct($name, $data, ValidatorInterface $validator, array $options = array())
 {
     $this->validator = $validator;
     $this->setData($data);
     if (FormConfiguration::isDefaultCsrfProtectionEnabled()) {
         $this->enableCsrfProtection();
     }
     if (FormConfiguration::getDefaultLocale() !== null) {
         $this->setLocale(FormConfiguration::getDefaultLocale());
     }
     parent::__construct($name, $options);
 }
Пример #2
0
 /**
  * Constructor.
  *
  * @param string $name
  * @param array|object $data
  * @param ValidatorInterface $validator
  * @param array $options
  */
 public function __construct($name, $data = null, ValidatorInterface $validator = null, array $options = array())
 {
     $this->validator = $validator;
     // Prefill the form with the given data
     if (null !== $data) {
         $this->setData($data);
     }
     if (FormConfiguration::isDefaultCsrfProtectionEnabled()) {
         $this->enableCsrfProtection();
     }
     parent::__construct($name, $options);
     // If data is passed to this constructor, objects from parent forms
     // should be ignored
     if (null !== $data) {
         $this->setPropertyPath(null);
     }
 }