You are here

class AutosaveFormErrorHandler in Autosave Form 8

Handles form errors.

Hierarchy

Expanded class hierarchy of AutosaveFormErrorHandler

1 string reference to 'AutosaveFormErrorHandler'
autosave_form.services.yml in ./autosave_form.services.yml
autosave_form.services.yml
1 service uses AutosaveFormErrorHandler
form_error_handler.autosave_form in ./autosave_form.services.yml
Drupal\autosave_form\Form\AutosaveFormErrorHandler

File

src/Form/AutosaveFormErrorHandler.php, line 12

Namespace

Drupal\autosave_form\Form
View source
class AutosaveFormErrorHandler extends FormErrorHandler {
  use AutosaveButtonClickedTrait;

  /**
   * The form error handler.
   *
   * @var \Drupal\Core\Form\FormErrorHandlerInterface
   */
  protected $formErrorHandler;

  /**
   * Constructs a AutosaveFormErrorHandler object.
   *
   * @param \Drupal\Core\Form\FormErrorHandlerInterface $form_error_handler
   *   The form error handler service.
   */
  public function __construct(FormErrorHandlerInterface $form_error_handler) {
    $this->formErrorHandler = $form_error_handler;
  }

  /**
   * {@inheritdoc}
   */
  public function handleFormErrors(array &$form, FormStateInterface $form_state) {
    if ($this
      ->isAutosaveTriggered($form_state)) {
      return $this;
    }
    return $this->formErrorHandler
      ->handleFormErrors($form, $form_state);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AutosaveButtonClickedTrait::isAutosaveTriggered protected function Checks if the submission is triggered by autosave save.
AutosaveButtonClickedTrait::isRejectTriggered protected function Checks if autosave restore has been triggered.
AutosaveButtonClickedTrait::isRestoreTriggered protected function Checks if autosave restore has been triggered.
AutosaveFormErrorHandler::$formErrorHandler protected property The form error handler.
AutosaveFormErrorHandler::handleFormErrors public function Handles form errors after form validation. Overrides FormErrorHandler::handleFormErrors
AutosaveFormErrorHandler::__construct public function Constructs a AutosaveFormErrorHandler object.
FormErrorHandler::displayErrorMessages protected function Loops through and displays all form errors. 1
FormErrorHandler::setElementErrorsFromFormState protected function Stores errors and a list of child element errors directly on each element.
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.