gist/src/Gist/Form/UserLoginForm.php

78 lines
1.9 KiB
PHP
Raw Normal View History

2015-11-21 18:28:48 +01:00
<?php
namespace Gist\Form;
use Symfony\Component\Validator\Constraints\NotBlank;
/**
2016-11-13 00:44:23 +01:00
* Class UserLoginForm.
*
2015-11-21 18:28:48 +01:00
* @author Simon Vieille <simon@deblan.fr>
*/
class UserLoginForm extends AbstractForm
{
2016-11-13 00:44:23 +01:00
/**
* {@inheritdoc}
*/
2015-11-21 18:28:48 +01:00
public function build(array $options = array())
{
$this->builder->add(
'_username',
'text',
array(
'required' => true,
'attr' => array(
'class' => 'form-control',
2016-05-31 22:20:17 +02:00
'placeholder' => $this->translator->trans('login.login.form.username.placeholder'),
2015-11-21 18:28:48 +01:00
),
'constraints' => array(
new NotBlank(array(
'message' => $this->translator->trans('form.error.not_blank'),
)),
),
)
);
$this->builder->add(
'_password',
'password',
array(
'required' => true,
'attr' => array(
'class' => 'form-control',
2016-05-31 22:20:17 +02:00
'placeholder' => $this->translator->trans('login.login.form.password.placeholder'),
2015-11-21 18:28:48 +01:00
),
'constraints' => array(
new NotBlank(array(
'message' => $this->translator->trans('form.error.not_blank'),
)),
),
)
);
2016-11-13 00:44:23 +01:00
2016-05-31 22:20:17 +02:00
$this->builder->add(
'_remember_me',
'checkbox',
array(
'label' => $this->translator->trans('login.login.form.remember_me.label'),
'required' => false,
'mapped' => false,
'attr' => array(
),
'constraints' => array(
),
)
);
2015-11-21 18:28:48 +01:00
return $this->builder;
}
2016-11-13 00:44:23 +01:00
/**
* {@inheritdoc}
*/
2015-11-21 18:28:48 +01:00
public function getName()
{
return '';
}
}