Verified Commit cb778841 authored by Dave Long's avatar Dave Long
Browse files

Issue #3352984 by lauriii, catch, longwave, smustgrave, geek-merlin,...

Issue #3352984 by lauriii, catch, longwave, smustgrave, geek-merlin, bkosborne, Wim Leers: Use httpMethod instead of type for AJAX get/post request property
parent 492062df
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -244,7 +244,7 @@ public static function processAjaxForm(&$element, FormStateInterface $form_state
   *   - #ajax['event']
   *   - #ajax['prevent']
   *   - #ajax['url']
   *   - #ajax['type']
   *   - #ajax['httpMethod']
   *   - #ajax['callback']
   *   - #ajax['options']
   *   - #ajax['wrapper']
@@ -341,7 +341,7 @@ public static function preRenderAjaxForm($element) {
      // to be substantially different for a JavaScript triggered submission.
      $settings += [
        'url' => NULL,
        'type' => 'POST',
        'httpMethod' => 'POST',
        'options' => ['query' => []],
        'dialogType' => 'ajax',
      ];
+6 −6
Original line number Diff line number Diff line
@@ -325,12 +325,12 @@
        elementSettings.url = href;
        elementSettings.event = 'click';
      }
      const type = $linkElement.data('ajax-type');
      const httpMethod = $linkElement.data('ajax-http-method');
      /**
       * In case of setting custom ajax type for link we rewrite ajax.type.
       * In case of setting custom ajax http method for link we rewrite ajax.httpMethod.
       */
      if (type) {
        elementSettings.type = type;
      if (httpMethod) {
        elementSettings.httpMethod = httpMethod;
      }
      Drupal.ajax(elementSettings);
    });
@@ -398,7 +398,7 @@
   */
  Drupal.Ajax = function (base, element, elementSettings) {
    const defaults = {
      type: 'POST',
      httpMethod: 'POST',
      event: element ? 'mousedown' : null,
      keypress: true,
      selector: base ? `#${base}` : null,
@@ -599,7 +599,7 @@
      },
      dataType: 'json',
      jsonp: false,
      type: ajax.type,
      method: ajax.httpMethod,
    };

    if (elementSettings.dialog) {
+3 −3
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@
    this.element_settings = {
      url: ajaxPath + queryString,
      submit: settings,
      type: 'GET',
      httpMethod: 'GET',
      setClick: true,
      event: 'click',
      selector,
@@ -128,7 +128,7 @@
    const selfSettings = $.extend({}, this.element_settings, {
      event: 'RefreshView',
      base: this.selector,
      type: 'GET',
      httpMethod: 'GET',
      element: this.$view.get(0),
    });
    this.refreshViewAjax = Drupal.ajax(selfSettings);
@@ -203,7 +203,7 @@
      submit: viewData,
      base: false,
      element: link,
      type: 'GET',
      httpMethod: 'GET',
    });
    this.pagerAjax = Drupal.ajax(selfSettings);
  };