Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use dynamic action variable to template #7729

Merged
merged 2 commits into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/Controller/CRUDController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1340,9 +1340,6 @@ final protected function trans(string $id, array $parameters = [], ?string $doma
return $translator->trans($id, $parameters, $domain, $locale);
}

/**
* @psalm-suppress PossiblyUndefinedMethod https://github.com/psalm/psalm-plugin-symfony/pull/243
*/
protected function handleXmlHttpRequestErrorResponse(Request $request, FormInterface $form): ?JsonResponse
{
if ([] === array_intersect(['application/json', '*/*'], $request->getAcceptableContentTypes())) {
Expand Down
8 changes: 4 additions & 4 deletions src/Resources/views/CRUD/base_list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ file that was distributed with this source code.

{% apply spaceless %}
<th class="sonata-ba-list-field-header-{{ field_description.type }}{% if sortable %} sonata-ba-list-field-header-order-{{ sort_by|lower }} {{ sort_active_class }}{% endif %}{% if field_description.option('header_class') %} {{ field_description.option('header_class') }}{% endif %}"{% if field_description.option('header_style') %} style="{{ field_description.option('header_style') }}"{% endif %}>
{% if sortable %}<a href="{{ admin.generateUrl('list', sort_parameters|merge({_list_mode: admin.getListMode()})) }}">{% endif %}
{% if sortable %}<a href="{{ admin.generateUrl(action|default('list'), sort_parameters|merge({_list_mode: admin.getListMode()})) }}">{% endif %}
{% if field_description.getOption('label_icon') %}
<span class="sonata-ba-list-field-header-label-icon">
{{ field_description.getOption('label_icon')|parse_icon }}
Expand Down Expand Up @@ -125,7 +125,7 @@ file that was distributed with this source code.
<ul class="list-inline">
{%- if admin.datagrid.pager.countResults() > 0 -%}
<li>
<a href="{{ admin.generateUrl('list', admin.datagrid.getPaginationParameters(1)) }}">
<a href="{{ admin.generateUrl(action|default('list'), admin.datagrid.getPaginationParameters(1)) }}">
{{- 'go_to_the_first_page'|trans({}, 'SonataAdminBundle') -}}
</a>
</li>
Expand Down Expand Up @@ -297,7 +297,7 @@ file that was distributed with this source code.
<div class="box-body">
<form
class="sonata-filter-form form-horizontal {{ admin.isChild and 1 == admin.datagrid.filters|length ? 'hide' : '' }}"
action="{{ admin.generateUrl('list') }}"
action="{{ admin.generateUrl(action|default('list')) }}"
method="GET"
role="form"
data-default-values="{{ admin.defaultFilterParameters|json_encode }}"
Expand Down Expand Up @@ -357,7 +357,7 @@ file that was distributed with this source code.
<i class="fas fa-filter" aria-hidden="true"></i> {{ 'btn_filter'|trans({}, 'SonataAdminBundle') }}
</button>

<a class="btn btn-default" href="{{ admin.generateUrl('list', {filters: 'reset'}) }}">
<a class="btn btn-default" href="{{ admin.generateUrl(action|default('list'), {filters: 'reset'}) }}">
{{ 'link_reset_filter'|trans({}, 'SonataAdminBundle') }}
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/CRUD/list__select.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ file that was distributed with this source code.
{% extends get_admin_template('base_list_field', admin.code) %}

{% block field %}
<a class="btn btn-primary" href="{{ admin.generateUrl('list') }}">
<a class="btn btn-primary" href="{{ admin.generateUrl(action|default('list')) }}">
<i class="fas fa-check" aria-hidden="true"></i>
{{ 'list_select'|trans({}, 'SonataAdminBundle') }}
</a>
Expand Down
6 changes: 2 additions & 4 deletions src/Resources/views/CRUD/tree.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ file that was distributed with this source code.

#}

{#
This template is not used at all, it is just a template that you can use to create
your own custom tree view.
#}
{% deprecated 'The "tree.html.twig" template is deprecated since sonata-project/admin-bundle version 4.x and will be removed in 5.0.' %}

{% extends '@SonataAdmin/CRUD/base_list.html.twig' %}

{% import _self as tree %}
Expand Down