BookAdminEditForm::validateForm

public BookAdminEditForm::validateForm(array &$form, FormStateInterface $form_state)

Form validation handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormBase::validateForm

File

core/modules/book/src/Form/BookAdminEditForm.php, line 84

Class

BookAdminEditForm
Provides a form for administering a single book's hierarchy.

Namespace

Drupal\book\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if ($form_state->getValue('tree_hash') != $form_state->getValue('tree_current_hash')) {
    $form_state->setErrorByName('', $this->t('This book has been modified by another user, the changes could not be saved.'));
  }
}
doc_Drupal
2016-10-29 08:48:00
Comments
Leave a Comment

Please login to continue.