public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if (!$options['csrf_protection']) {
            return;
        }

        $builder
            ->addEventSubscriber(new CsrfValidationListener(
                $options['csrf_field_name'],
                $options['csrf_token_manager'],
                $options['csrf_token_id'] ?: ($builder->getName() ?: \get_class($builder->getType()->getInnerType())),
                $options['csrf_message'],
                $this->translator,
                $this->translationDomain,
                $this->serverParams
            ))
        ;
    }
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        if (!$options['csrf_protection']) {
            return;
        }

        $builder
            ->addEventSubscriber(new CsrfValidationListener(
                $options['csrf_field_name'],
                $options['csrf_token_manager'],
                $options['csrf_token_id'] ?: ($builder->getName() ?: \get_class($builder->getType()->getInnerType())),
                $options['csrf_message'],
                $this->translator,
                $this->translationDomain,
                $this->serverParams
            ))
        ;
    }
public function buildForm ( FormBuilderInterface $ builder , array $ options ) { if ( ! $ options [ 'csrf_protection' ] ) { return ; } $ builder -> addEventSubscriber ( new CsrfValidationListener ( $ options [ 'csrf_field_name' ] , $ options [ 'csrf_token_manager' ] , $ options [ 'csrf_token_id' ] ? : ( $ builder -> getName ( ) ? : \ get_class ( $ builder -> getType ( ) -> getInnerType ( ) ) ) , $ options [ 'csrf_message' ] , $ this -> translator , $ this -> translationDomain , $ this -> serverParams ) ) ; }
Adds a CSRF field to the form when the CSRF protection is enabled.

@param FormBuilderInterface $builder The form builder
@param array                $options The options
Adds a CSRF field to the form when the CSRF protection is enabled .