EasyAdminBundle icon indicating copy to clipboard operation
EasyAdminBundle copied to clipboard

Add hideIf() feature

Open ucscode opened this issue 7 months ago • 3 comments

Short description of what this feature will allow to do: Rather than hide a field based on a page, user can create a custom way to determine whether the field should be hidden or not!

Example of how to use this feature

yield TextField::new('property')
  ->hideIf(function($entity) {
     return !$entity->hasRequiredProperty();
  });
;

ucscode avatar May 01 '25 07:05 ucscode

I 💯 support this feature !

Geolim4 avatar May 04 '25 13:05 Geolim4

It seems like something similar can be done like this:

$entityInstance = $this->getContext()->getEntity()->getInstance();

if ($entityInstance->hasRequiredProperty()) {
    yield TextField::new('property');
}

zpi12lmm avatar May 04 '25 19:05 zpi12lmm

It seems like something similar can be done like this:

$entityInstance = $this->getContext()->getEntity()->getInstance();

if ($entityInstance->hasRequiredProperty()) { yield TextField::new('property'); }

Not working with embedded controllers

Geolim4 avatar May 04 '25 19:05 Geolim4