How do I create password input type in Symfony EasyAdmin 3 admin form.
In EasyAdmin 2 I could use - { property: ..., type: 'password' }
What is EasyAdmin 3 version of this?
Asked
Active
Viewed 4,356 times
2

Anastasia Sitnina
- 551
- 8
- 24
1 Answers
10
Use text field and set form type to PasswordType
yield TextField::new('password')->setFormType(PasswordType::class);

Flash
- 1,101
- 1
- 9
- 13
-
Function setFormTypeOption requires 2 parameters: string $optionName, $optionValue. If I use your example I get an error: "Too few arguments to function EasyCorp\Bundle\EasyAdminBundle\Field\TextField::setFormTypeOption(), 1 passed in \src\Controller\Admin\UserCrudController.php on line 24 and exactly 2 expected" – Anastasia Sitnina Jun 09 '21 at 23:37
-
1Sorry, method name is `setFormType`, my mistake. – Flash Jun 11 '21 at 08:43
-
How to encrypt it? In this case I got not hashed password. – Nisk May 02 '22 at 12:34
-
1@NikitaPushkar You can encrypt it in event subscriber – Flash May 02 '22 at 13:43