You are here

public function ScheduledTransitionAddForm::validateForm in Scheduled Transitions 8

Same name and namespace in other branches
  1. 2.x src/Form/Entity/ScheduledTransitionAddForm.php \Drupal\scheduled_transitions\Form\Entity\ScheduledTransitionAddForm::validateForm()

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

src/Form/Entity/ScheduledTransitionAddForm.php, line 288

Class

ScheduledTransitionAddForm
Scheduled transitions add form.

Namespace

Drupal\scheduled_transitions\Form\Entity

Code

public function validateForm(array &$form, FormStateInterface $form_state) : void {
  if (empty($form_state
    ->getValue('revision'))) {
    $form_state
      ->setError($form['scheduled_transitions']['revision'], $this
      ->t('Revision must be selected.'));
  }
}