EasyAdminBundle
EasyAdminBundle copied to clipboard
Dynamic label for custom actions
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()]))