You are here

protected function KeyFormBase::moveFormStateErrors in Key 8

Moves form errors from one form state to another.

Parameters

\Drupal\Core\Form\FormStateInterface $from: The form state object to move from.

\Drupal\Core\Form\FormStateInterface $to: The form state object to move to.

1 call to KeyFormBase::moveFormStateErrors()
KeyFormBase::validateForm in src/Form/KeyFormBase.php
Form validation handler.

File

src/Form/KeyFormBase.php, line 512

Class

KeyFormBase
Base form for key add and edit forms.

Namespace

Drupal\key\Form

Code

protected function moveFormStateErrors(FormStateInterface $from, FormStateInterface $to) {
  foreach ($from
    ->getErrors() as $name => $error) {
    $to
      ->setErrorByName($name, $error);
  }
}