AutosaveFormErrorHandler.php in Autosave Form 8
File
src/Form/AutosaveFormErrorHandler.php
View source
<?php
namespace Drupal\autosave_form\Form;
use Drupal\Core\Form\FormErrorHandler;
use Drupal\Core\Form\FormErrorHandlerInterface;
use Drupal\Core\Form\FormStateInterface;
class AutosaveFormErrorHandler extends FormErrorHandler {
use AutosaveButtonClickedTrait;
protected $formErrorHandler;
public function __construct(FormErrorHandlerInterface $form_error_handler) {
$this->formErrorHandler = $form_error_handler;
}
public function handleFormErrors(array &$form, FormStateInterface $form_state) {
if ($this
->isAutosaveTriggered($form_state)) {
return $this;
}
return $this->formErrorHandler
->handleFormErrors($form, $form_state);
}
}