Same filename and directory in other branches
- 8.9.x core/lib/Drupal/Core/Ajax/AjaxHelperTrait.php
- 9 core/lib/Drupal/Core/Ajax/AjaxHelperTrait.php
Namespace
Drupal\Core\Ajax
File
core/lib/Drupal/Core/Ajax/AjaxHelperTrait.php
View source
<?php
namespace Drupal\Core\Ajax;
use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
trait AjaxHelperTrait {
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');
}
protected function getRequestWrapperFormat() {
return \Drupal::request()
->get(MainContentViewSubscriber::WRAPPER_FORMAT);
}
}
Traits
Name |
Description |
AjaxHelperTrait |
Provides a helper to determine if the current request is via AJAX. |