-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
AdminAdminBundle related issues and PRs.AdminBundle related issues and PRs.EnhancementMinor issues and PRs improving the current solutions (optimizations, typo fixes, etc.).Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.).
Description
Sylius version affected: 1 and 2
Description
When using the default Grid Action, I must define a route even if I already defined a url. I should be able to not define a route, because the URL is already defined.
Steps to reproduce
Create a button in the grid with the "default" template, and only define the options.link.url .
sylius_grid:
grids:
sylius_admin_exchange_rate:
actions:
main:
custom_url:
type: default
label: test
options:
link:
url: '/my-custom-url'
# route: 'sylius_admin_exchange_rate_index' # needed to work right nowPossible Solution
It seems that the default function is still called even if route is already defined.
It should be able to add a check if URL is defined, then we don't need to have a default route.
{% set path = options.link.url|default('') is not empty ? options.link.url : path(options.link.route, options.link.parameters|default({})) %}UPDATE :
I just saw the AdminBundle/templates/shared/grid/action/links.html.twig:19 file where the links are handled this way :
{% set path = link.url is defined ? link.url : path(link.route, link.parameters|default([])) %}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
AdminAdminBundle related issues and PRs.AdminBundle related issues and PRs.EnhancementMinor issues and PRs improving the current solutions (optimizations, typo fixes, etc.).Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.).