function FormAjaxSubscriber::getFormAjaxException

Same name in other branches
  1. 9 core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php \Drupal\Core\Form\EventSubscriber\FormAjaxSubscriber::getFormAjaxException()
  2. 8.9.x core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php \Drupal\Core\Form\EventSubscriber\FormAjaxSubscriber::getFormAjaxException()
  3. 10 core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php \Drupal\Core\Form\EventSubscriber\FormAjaxSubscriber::getFormAjaxException()

Extracts a form AJAX exception.

Parameters

\Throwable $e: A generic exception that might contain a form AJAX exception.

Return value

\Drupal\Core\Form\FormAjaxException|null Either the form AJAX exception, or NULL if none could be found.

1 call to FormAjaxSubscriber::getFormAjaxException()
FormAjaxSubscriber::onException in core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php
Catches a form AJAX exception and build a response from it.

File

core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php, line 136

Class

FormAjaxSubscriber
Wraps AJAX form submissions that are triggered via an exception.

Namespace

Drupal\Core\Form\EventSubscriber

Code

protected function getFormAjaxException(\Throwable $e) {
    $exception = NULL;
    while ($e) {
        if ($e instanceof FormAjaxException) {
            $exception = $e;
            break;
        }
        $e = $e->getPrevious();
    }
    return $exception;
}

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