function BookAdminEditForm::validateForm

Same name in other branches
  1. 9 core/modules/book/src/Form/BookAdminEditForm.php \Drupal\book\Form\BookAdminEditForm::validateForm()
  2. 8.9.x core/modules/book/src/Form/BookAdminEditForm.php \Drupal\book\Form\BookAdminEditForm::validateForm()
  3. 11.x core/modules/book/src/Form/BookAdminEditForm.php \Drupal\book\Form\BookAdminEditForm::validateForm()

Overrides FormBase::validateForm

File

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

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.'));
    }
}

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