Skip to content

Commit

Permalink
Do not lose _route_params (#7211)
Browse files Browse the repository at this point in the history
* Do not lose _route_params

* Avoid test error
  • Loading branch information
VincentLanglet authored May 25, 2021
1 parent 8527c20 commit 2cce28c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ This code manages the many-to-[one|many] association field popup
sonata_admin.admin.root.hasRequest()
? sonata_admin.admin.root.request.attributes.get('_route_params', {})
: {}
)) }}',
) + app.request.query.all|default({})
) }}',
data: {_xml_http_request: true },
dataType: 'html',
type: 'POST',
Expand Down Expand Up @@ -537,7 +538,8 @@ This code manages the many-to-[one|many] association field popup
associationadmin.hasRequest()
? associationadmin.request.attributes.get('_route_params', {})
: {}
))}}'.replace('OBJECT_ID', objectId),
) + app.request.query.all|default({})
)}}'.replace('OBJECT_ID', objectId),
dataType: 'html',
success: function(html) {
jQuery('#field_widget_{{ id }}').html(html);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ file that was distributed with this source code.
sonata_admin.field_description.associationadmin.hasRequest()
? sonata_admin.field_description.associationadmin.request.attributes.get('_route_params', {})
: {}
))) }}
) + app.request.query.all|default({})
)) }}
{% elseif sonata_admin.field_description.option('placeholder', 'short_object_description_placeholder') %}
<span class="inner-field-short-description">
{{ sonata_admin.field_description.option('placeholder', 'short_object_description_placeholder')|trans({}, 'SonataAdminBundle') }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ This code manages the one-to-many association field popup
'elementId': id,
'objectId': sonata_admin.admin.root.id(sonata_admin.admin.root.subject),
'uniqid': sonata_admin.admin.root.uniqid,
'subclass': app.request.query.get('subclass'),
} + sonata_admin.field_description.getOption('link_parameters', {})
+ (
sonata_admin.admin.root.hasRequest()
? sonata_admin.admin.root.request.attributes.get('_route_params', {})
: {}
)) }}',
) + app.request.query.all|default({})
) }}',
type: "POST",
dataType: 'html',
data: { _xml_http_request: true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ file that was distributed with this source code.
sonata_admin.field_description.associationadmin.hasRequest()
? sonata_admin.field_description.associationadmin.request.attributes.get('_route_params', {})
: {}
))) }}
) + app.request.query.all|default({})
)) }}
{% elseif sonata_admin.field_description.option('placeholder', 'short_object_description_placeholder') %}
<span class="inner-field-short-description">
{{ sonata_admin.field_description.option('placeholder', 'short_object_description_placeholder')|trans({}, 'SonataAdminBundle') }}
Expand Down
1 change: 1 addition & 0 deletions src/Resources/views/CRUD/base_list_field.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ file that was distributed with this source code.
'code': admin.code(object)
} + (admin.hasRequest() ? admin.request.attributes.get('_route_params', {}) : {})
+ admin.getPersistentParameters()
+ app.request.query.all|default({})
) %}

{% if field_description.type == constant('Sonata\\AdminBundle\\Admin\\FieldDescriptionInterface::TYPE_DATE') and value is not empty %}
Expand Down
3 changes: 2 additions & 1 deletion src/Resources/views/Form/form_admin_fields.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,8 @@ file that was distributed with this source code.
sonata_admin.field_description.associationadmin.hasRequest()
? sonata_admin.field_description.associationadmin.request.attributes.get('_route_params', {})
: {}
))) }}
) + app.request.query.all|default({})
)) }}
{% elseif sonata_admin.field_description.option('placeholder', 'short_object_description_placeholder') %}
<span class="inner-field-short-description">
{{ sonata_admin.field_description.option('placeholder', 'short_object_description_placeholder')|trans({}, 'SonataAdminBundle') }}
Expand Down

0 comments on commit 2cce28c

Please sign in to comment.