EasyCorp / EasyAdminBundle

EasyAdmin is a fast, beautiful and modern admin generator for Symfony applications.
MIT License
3.99k stars 1.01k forks source link

Dynamic label for custom actions #6291

Open astronati opened 2 weeks ago

astronati commented 2 weeks ago

Short description of what this feature will allow to do: It could happen that the label of an action could be dependent on the entity values. In my case would be helpful showing the count of a OneToMany relationship in order to see something "SEE ALL (14)"

Example of how to use this feature The setLabel method should accept an anonymous function that has as first argument the entity itself

->setLabel(fn ($entity): string => $this->translator->trans('SEE_ALL', ['%count% => $entity->getRelationshipCount()]))