From 28c0aa33ad7957bc28390708c714d6d84ec4a0b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Fr=C3=A9mont?= Date: Tue, 3 Feb 2026 14:07:27 +0100 Subject: [PATCH] =?UTF-8?q?[Docs]=C2=A0Action=20templates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/grid/actions.md | 47 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/docs/grid/actions.md b/docs/grid/actions.md index e7808d0d..fb6e12f3 100644 --- a/docs/grid/actions.md +++ b/docs/grid/actions.md @@ -55,7 +55,10 @@ final class SpeakerGrid extends AbstractGrid ->addActionGroup( MainActionGroup::create( // Add the "create" action into the "main" action group - CreateAction::create(), + CreateAction::create() + // Optional, you can configure this globally instead. + ->setTemplate('path/to/your/action/template.html.twig') + , ), ) ; @@ -91,7 +94,10 @@ final class SpeakerGrid extends AbstractGrid ->addActionGroup( ItemActionGroup::create( // Add the "update" action into the "item" action group - UpdateAction::create(), + UpdateAction::create() + // Optional, you can configure this globally instead. + ->setTemplate('path/to/your/action/template.html.twig') + , ), ) ; @@ -128,13 +134,19 @@ final class SpeakerGrid extends AbstractGrid ->addActionGroup( ItemActionGroup::create( // Add the "delete" action into the "item" action group - DeleteAction::create(), + DeleteAction::create() + // Optional, you can configure this globally instead. + ->setTemplate('path/to/your/action/template.html.twig') + , ), ) ->addActionGroup( BulkActionGroup::create( // Add the "delete" action into the "bulk" action group - DeleteAction::create(), + DeleteAction::create() + // Optional, you can configure this globally instead. + ->setTemplate('path/to/your/action/template.html.twig') + , ), ) ; @@ -170,7 +182,10 @@ final class SpeakerGrid extends AbstractGrid ->addActionGroup( ItemActionGroup::create( // Add the "show" action into the "item" action group - ShowAction::create(), + ShowAction::create() + // Optional, you can configure this globally instead. + ->setTemplate('path/to/your/action/template.html.twig') + , ), ) ; @@ -178,6 +193,26 @@ final class SpeakerGrid extends AbstractGrid } ``` +## Configuring your action templates globally + +```yaml +sylius_grid: + templates: + action: + create: path/to/your/create.html.twig + delete: path/to/your/delete.html.twig + show: path/to/your/show.html.twig + update: path/to/your/update.html.twig + bulk_action: + delete: path/to/your/delete.html.twig +``` + +{% hint style="info" %} +The BootstrapAdminUi package will configure that for you automatically. + +[BootstrapAdminUi configuration files](https://github.com/Sylius/Stack/blob/main/src/BootstrapAdminUi/config/app/grid/templates.php) +{% endhint %} + ## Creating a custom Action There are certain cases when built-in action types are not enough. @@ -385,7 +420,7 @@ ids. Now, you can configure the grid action: sylius_grid: grids: app_admin_product: - ... + # ... actions: bulk: export: