Skip to content
Snippets Groups Projects

Issue #3519888 by jurgenhaas: ECA Misc: Add condition to see if the current request is ajax

Merged Issue #3519888 by jurgenhaas: ECA Misc: Add condition to see if the current request is ajax
Merged Jürgen Haas requested to merge issue/eca-3519888:3519888-eca-misc-add into 3.0.x
<?php
namespace Drupal\eca_misc\Plugin\ECA\Condition;
use Drupal\Core\Ajax\AjaxHelperTrait;
use Drupal\eca\Plugin\ECA\Condition\ConditionBase;
/**
* Condition plugin to determine if the current request is an AJAX request.
*
* @EcaCondition(
* id = "eca_is_ajax",
* label = "Is Ajax",
* description = @Translation("Determines if the current request is an AJAX request."),
* eca_version_introduced = "2.1.8"
* )
*/
class IsAjax extends ConditionBase {
use AjaxHelperTrait;
/**
* {@inheritdoc}
*/
public function evaluate(): bool {
$result = $this->isAjax();
return $this->negationCheck($result);
}
}
Loading