-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Short description of what this feature will allow to do:
Add support for URL fragments (hash anchors) to the AdminUrlGenerator class, enabling developers to generate admin URLs that scroll to specific sections of a page or reference/activate a specific tab (e.g. #tab-main). This could be realised by using Symfony's native router support for URL fragments via the _fragment parameter.
I am aware that it currently is possible to use $this->adminUrlGenerator->set('_fragment', 'tab-main') in order to achieve the requested behaviour, but I find it not very clean and consistent with the other dedicated functions EasyAdmin has (e.g., setEntityId() instead of set('entityId', ...) and setController() instead of set('crudControllerFqcn', ...)).
This enhancement makes it easier for developers to link directly to specific page sections (tabs, accordions, anchors) in their admin interfaces and to reference the fragment functionality in documentation.
_
Example of how to use this feature
$url = $this->adminUrlGenerator
->setController(SomeCrudController::class)
->setAction(Action::EDIT)
->setEntityId(123)
->setFragment('tab-inventory')
->generateUrl();
// Result: /admin/some/edit/123#tab-inventory