<commit_before><?php

namespace Nietonfir\Google\ReCaptchaBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Validator\Constraints\NotBlank;

class ReCaptchaType extends AbstractType
{
    private $sitekey;

    public function __construct($sitekey)
    {
        $this->sitekey = $sitekey;
    }

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('g-recaptcha-response', null, array(
            'constraints' => array(
                new NotBlank()
            )
        ));
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'mapped' => false,
            'attr' => array(
                'data-sitekey' => $this->sitekey,
                'class' => 'g-recaptcha'
            )
        ));
    }

    public function getParent()
    {
        return 'form';
    }

    public function getName()
    {
        return 'recaptcha';
    }
}<commit_msg>Enable error bubbling on the ReCaptchaType g-recaptcha-response field<commit_after><?php

namespace Nietonfir\Google\ReCaptchaBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Symfony\Component\Validator\Constraints\NotBlank;

class ReCaptchaType extends AbstractType
{
    private $sitekey;

    public function __construct($sitekey)
    {
        $this->sitekey = $sitekey;
    }

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('g-recaptcha-response', null, array(
            'error_bubbling' => true,
            'constraints' => array(
                new NotBlank()
            )
        ));
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'mapped' => false,
            'attr' => array(
                'data-sitekey' => $this->sitekey,
                'class' => 'g-recaptcha'
            )
        ));
    }

    public function getParent()
    {
        return 'form';
    }

    public function getName()
    {
        return 'recaptcha';
    }
}
{'fraction_non_alphanumeric': 0.1085304054054054, 'fraction_numerical': 0.0, 'mean_word_length': 2.3602836879432623, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1177616', 'n_tokens_mistral': 688, 'n_tokens_neox': 668, 'n_words': 125}