You are here

protected function AjaxHelperTrait::isAjax in Drupal 8

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Ajax/AjaxHelperTrait.php \Drupal\Core\Ajax\AjaxHelperTrait::isAjax()

Determines if the current request is via AJAX.

Return value

bool TRUE if the current request is via AJAX, FALSE otherwise.

9 calls to AjaxHelperTrait::isAjax()
AddSectionController::build in core/modules/layout_builder/src/Controller/AddSectionController.php
Adds the new section.
ChooseBlockController::getAjaxAttributes in core/modules/layout_builder/src/Controller/ChooseBlockController.php
Get dialog attributes if an ajax request.
ChooseSectionController::build in core/modules/layout_builder/src/Controller/ChooseSectionController.php
Choose a layout plugin to add as a section.
ConfigureBlockFormBase::doBuildForm in core/modules/layout_builder/src/Form/ConfigureBlockFormBase.php
Builds the form for the block.
ConfigureSectionForm::buildForm in core/modules/layout_builder/src/Form/ConfigureSectionForm.php
Form constructor.

... See full list

File

core/lib/Drupal/Core/Ajax/AjaxHelperTrait.php, line 20

Class

AjaxHelperTrait
Provides a helper to determine if the current request is via AJAX.

Namespace

Drupal\Core\Ajax

Code

protected function isAjax() {
  foreach ([
    'drupal_ajax',
    'drupal_modal',
    'drupal_dialog',
  ] as $wrapper) {
    if (strpos($this
      ->getRequestWrapperFormat(), $wrapper) !== FALSE) {
      return TRUE;
    }
  }
  return FALSE;
}