Pass parameters to linkToCrudAction
Short description of what this feature will allow to do:
Code a way to pass parameters to Action::linkToCrudAction().
Example of how to use this feature:
Currently, if one uses a GET parameter in a CRUD controller, like &entityId=1234, it's not possible to create a custom action that uses linkToCrudAction(), because there's no way to pass the parameter to the CRUD function. The clearer option I could find was to build the URL directly on configureActions(), like the example below. However, if one has several actions like this, the function gets quite messy...
$showInfo = Action::new('showInfo', 'works.showInfo')
->linkToUrl(fn() => $this->adminUrlGenerator
->setController(WorkCrudController::class)
->setAction($Crud::PAGE_DETAIL)
->setEntityId($work->getId())
->generateUrl()
)
->createAsGlobalAction();
Another option would be to use linkToRoute(), using a regular Symfony route, and including the parameter in the route parameters, but since it's just a redirect, a CRUD function would be enough.