Problem/Motivation

Since #956186: Allow AJAX to use GET requests and #3352984: Use httpMethod instead of type for AJAX get/post request property it is possible to open a dialog with Ajax via a GET request. However, with this link:

<a href="/some/path"
  class="use-ajax"
  data-dialog-type="modal"
  data-dialog-options="{&quot;width&quot;:800}"
  data-ajax-http-method="GET"
>Open dialog</a>

... the dialog options (data-dialog-options) are not followed. With POST everything works.

The MR contains a test proving the bug

Steps to reproduce

See the test.

Proposed resolution

Fix it.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

N/A

Issue fork drupal-3394220

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

claudiu.cristea created an issue. See original summary.

claudiu.cristea’s picture

Status: Active » Needs work
Issue tags: -JavaScript +JavaScript
claudiu.cristea’s picture

Status: Needs work » Needs review
Issue tags: -JavaScript +JavaScript

OK, we have green. Ready for review.

catch’s picture

Status: Needs review » Reviewed & tested by the community

Left a comment on the MR but then looked a bit more - Symfony marked Request::get() internal in Symfony 5.4, so we probably shouldn't go out of our way to use it (although I personally think the 'get this from GET or POST' is useful). Given that was my only question here, moving to RTBC. We probably don't need to worry about existing usages of Request::get() until and if Symfony actually deprecates it though.

claudiu.cristea’s picture

The data-ajax-http-method attribute hasn't been documented anywhere. Added few words here https://www.drupal.org/node/3089078/revisions/view/13205552/13270791

  • lauriii committed 291d8a2f on 11.x
    Issue #3394220 by claudiu.cristea, catch: Dialog options are not...

  • lauriii committed e1cdbcf9 on 10.2.x
    Issue #3394220 by claudiu.cristea, catch: Dialog options are not...

  • lauriii committed a6196c52 on 10.1.x
    Issue #3394220 by claudiu.cristea, catch: Dialog options are not...
lauriii’s picture

Version: 11.x-dev » 10.1.x-dev
Status: Reviewed & tested by the community » Fixed

Committed 291d8a2 and pushed to 11.x. Cherry-picked all the way to 10.1.x. Thanks!

claudiu.cristea’s picture

Crediting @huzooka as he has discovered the bug

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.