SonataAdminBundle icon indicating copy to clipboard operation
SonataAdminBundle copied to clipboard

Autoinject all admin variables

Open core23 opened this issue 4 years ago • 5 comments
trafficstars

Subject

With this PR it is not necessary to use the CRUDController::renderWithExtraParams to render a template in the admin context. All admin pages with a _sonata_admin parameter inside the route configuration can use the autoinjected twig variables for that admin page.

IMHO we can remove this method on the master branch after merging: https://github.com/sonata-project/SonataAdminBundle/blob/4.x/src/Controller/CRUDController.php#L932

I am targeting this branch, because this feature is BC.

Changelog

### Added
-  Autoinject all admin variables using event listeners

core23 avatar Sep 11 '21 14:09 core23

Subject

With this PR it is not necessary to use the CRUDController::renderWithExtraParams to render a template in the admin context. All admin pages with a _sonata_admin parameter inside the route configuration can use the autoinjected twig variables for that admin page.

What if the method was overridden by someone ?

IMHO we can remove this method on the master branch after merging: https://github.com/sonata-project/SonataAdminBundle/blob/4.x/src/Controller/CRUDController.php#L932

What would be the way to override the base template then ? Should we add deprecation message and documentation ?

VincentLanglet avatar Sep 11 '21 15:09 VincentLanglet

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Mar 10 '22 16:03 github-actions[bot]

Should we add a next major comment to remove the code inside addRenderExtraParams ?

Probably other bundles should adapt the implementation to not use this method too, imo we should remove it.

jordisala1991 avatar Mar 21 '22 13:03 jordisala1991

Do we have tests covering this new class?

jordisala1991 avatar Mar 21 '22 13:03 jordisala1991

Do you have time to finish this PR @core23 ?

VincentLanglet avatar Jun 25 '22 09:06 VincentLanglet

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Dec 22 '22 10:12 github-actions[bot]