public function EntityUpdateExec::validateForm in Entity Update 8
Same name and namespace in other branches
- 2.0.x src/Form/EntityUpdateExec.php \Drupal\entity_update\Form\EntityUpdateExec::validateForm()
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
- src/Form/ EntityUpdateExec.php, line 148 
Class
- EntityUpdateExec
- Class CheckEntityUpdate.
Namespace
Drupal\entity_update\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
  $list = EntityUpdate::getEntityTypesToUpdate();
  $action = $form_state
    ->getValue('action');
  $actions = [
    'rescue',
  ];
  if (!in_array($action, $actions) && empty($list)) {
    $form_state
      ->setErrorByName('about', $this
      ->t("Nothing to update. All entities are up to date;"));
  }
  elseif (!$form_state
    ->getValue('confirm')) {
    $form_state
      ->setErrorByName('confirm', $this
      ->t("If you want to execute, please check the checkbox."));
  }
}