You are here

protected static function WebformComputedBase::isAjax in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Element/WebformComputedBase.php \Drupal\webform\Element\WebformComputedBase::isAjax()

Determine if the current request is using Ajax.

1 call to WebformComputedBase::isAjax()
WebformComputedBase::submitWebformComputedCallback in src/Element/WebformComputedBase.php
Webform computed element submit callback.

File

src/Element/WebformComputedBase.php, line 215

Class

WebformComputedBase
Provides a base class for 'webform_computed' elements.

Namespace

Drupal\webform\Element

Code

protected static function isAjax() {

  // return (\Drupal::request()->get(MainContentViewSubscriber::WRAPPER_FORMAT) === 'drupal_ajax');
  //
  // ISSUE:
  // For nodes with computed elements there is a duplicate
  // _wrapper_format parameter.
  // (i.e ?_wrapper_format=html&_wrapper_format=drupal_ajax)
  // WORKAROUND:
  // See if _wrapper_format=drupal_ajax is being appended to the query string.
  $querystring = \Drupal::request()
    ->getQueryString();
  return strpos($querystring, MainContentViewSubscriber::WRAPPER_FORMAT . '=drupal_ajax') !== FALSE;
}