function AjaxHelperTrait::isAjax

Same name in other branches
  1. 9 core/lib/Drupal/Core/Ajax/AjaxHelperTrait.php \Drupal\Core\Ajax\AjaxHelperTrait::isAjax()
  2. 8.9.x core/lib/Drupal/Core/Ajax/AjaxHelperTrait.php \Drupal\Core\Ajax\AjaxHelperTrait::isAjax()
  3. 10 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() {
    $wrapper_format = $this->getRequestWrapperFormat() ?? '';
    return str_contains($wrapper_format, 'drupal_ajax') || str_contains($wrapper_format, 'drupal_modal') || str_contains($wrapper_format, 'drupal_dialog');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.