ForkCMS\Bundle\InstallerBundle\Form\Type\LoginType::buildForm PHP Method

buildForm() public method

public buildForm ( Symfony\Component\Form\FormBuilderInterface $builder, array $options )
$builder Symfony\Component\Form\FormBuilderInterface
$options array
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('email', 'email')->add('password', 'repeated', array('type' => 'password', 'invalid_message' => 'The passwords do not match.', 'required' => true, 'first_options' => array('label' => 'Password'), 'second_options' => array('label' => 'Confirm')));
        // make sure the default data is set
        $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
            $data = $event->getData();
            $email = $data->getEmail();
            if (empty($email) && isset($_SERVER['HTTP_HOST'])) {
                $data->setEmail('info@' . $_SERVER['HTTP_HOST']);
                $event->setData($data);
            }
        });
    }