Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic label for custom actions #6291

Open
astronati opened this issue May 1, 2024 · 0 comments
Open

Dynamic label for custom actions #6291

astronati opened this issue May 1, 2024 · 0 comments

Comments

@astronati
Copy link

astronati commented May 1, 2024

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()]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant