You are here

public function CacheflushEntityForm::validateForm in CacheFlush 8

Button-level validation handlers are highly discouraged for entity forms, as they will prevent entity validation from running. If the entity is going to be saved during the form submission, this method should be manually invoked from the button-level validation handler, otherwise an exception will be thrown.

Overrides ContentEntityForm::validateForm

File

modules/cacheflush_ui/src/Entity/Form/CacheflushEntityForm.php, line 82

Class

CacheflushEntityForm
Form controller for Cacheflush entity edit forms.

Namespace

Drupal\cacheflush_ui\Entity\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $entity = parent::validateForm($form, $form_state);

  // Call validation function for tabs.
  foreach ($form_state
    ->getStorage()['cacheflush_tabs'] as $tab => $value) {
    $value['validation']($tab, $form, $form_state);
  }
  return $entity;
}