7

is there any chance to disable an field to user using EasyAdmin's implemented fields?

I would like to show to user a boolean value of isPaid, but i don't want him to change it, just show him (the payment gateway does this)

desertnaut
  • 57,590
  • 26
  • 140
  • 166
Jakub Novák
  • 168
  • 2
  • 10

2 Answers2

15

What you are probably looking for is this:

BooleanField::new('isPaid')->setFormTypeOption('disabled','disabled');
Johan
  • 843
  • 8
  • 10
6

Actually all i needed and wanted is this:

public function configureFields(string $pageName): iterable
{
    ...
    $isPaid = BooleanField::new('isPaid')->renderAsSwitch(false)->hideOnForm();
    ...
}
desertnaut
  • 57,590
  • 26
  • 140
  • 166
Jakub Novák
  • 168
  • 2
  • 10