diff options
Diffstat (limited to 'vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/PasswordType.php')
-rw-r--r-- | vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/PasswordType.php | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/PasswordType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/PasswordType.php new file mode 100644 index 00000000..5a5b1635 --- /dev/null +++ b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/PasswordType.php | |||
@@ -0,0 +1,57 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Form\Extension\Core\Type; | ||
13 | |||
14 | use Symfony\Component\Form\AbstractType; | ||
15 | use Symfony\Component\Form\FormInterface; | ||
16 | use Symfony\Component\Form\FormView; | ||
17 | use Symfony\Component\OptionsResolver\OptionsResolverInterface; | ||
18 | |||
19 | class PasswordType extends AbstractType | ||
20 | { | ||
21 | /** | ||
22 | * {@inheritdoc} | ||
23 | */ | ||
24 | public function buildView(FormView $view, FormInterface $form, array $options) | ||
25 | { | ||
26 | if ($options['always_empty'] || !$form->isSubmitted()) { | ||
27 | $view->vars['value'] = ''; | ||
28 | } | ||
29 | } | ||
30 | |||
31 | /** | ||
32 | * {@inheritdoc} | ||
33 | */ | ||
34 | public function setDefaultOptions(OptionsResolverInterface $resolver) | ||
35 | { | ||
36 | $resolver->setDefaults(array( | ||
37 | 'always_empty' => true, | ||
38 | 'trim' => false, | ||
39 | )); | ||
40 | } | ||
41 | |||
42 | /** | ||
43 | * {@inheritdoc} | ||
44 | */ | ||
45 | public function getParent() | ||
46 | { | ||
47 | return 'text'; | ||
48 | } | ||
49 | |||
50 | /** | ||
51 | * {@inheritdoc} | ||
52 | */ | ||
53 | public function getName() | ||
54 | { | ||
55 | return 'password'; | ||
56 | } | ||
57 | } | ||