EasyAdminBundle icon indicating copy to clipboard operation
EasyAdminBundle copied to clipboard

Dynamic label for custom actions

Open astronati opened this issue 9 months ago • 0 comments

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()]))

astronati avatar May 01 '24 13:05 astronati