Creating a custom Bulk Action
In some cases, forcing the user to click a button for each item in a grid isn't practical. Fortunately, you can take advantage of built-in bulk actions. However, these may not always be sufficient and might need customization.
To do this, simply create your own bulk action template and register it inside the sylius_grid
.
In the template we will specify the button's icon to be export
and its colour to be orange
.
@App/Grid/BulkAction/export.html.twig
Now configure the new action's template:
config/packages/sylius_grid.yaml
From now on, you can use your new bulk action type in the grid configuration!
Let's assume that you already have a route for exporting by injecting ids. Now, you can configure the grid action:
config/packages/sylius_grid.yaml
Last updated