UpdateManagerUpdate::validateForm

public UpdateManagerUpdate::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/update/src/Form/UpdateManagerUpdate.php, line 297

Class

UpdateManagerUpdate
Configure update settings for this site.

Namespace

Drupal\update\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (!$form_state->isValueEmpty('projects')) {
    $enabled = array_filter($form_state->getValue('projects'));
  }
  if (!$form_state->isValueEmpty('disabled_projects')) {
    $disabled = array_filter($form_state->getValue('disabled_projects'));
  }
  if (empty($enabled) && empty($disabled)) {
    $form_state->setErrorByName('projects', $this->t('You must select at least one project to update.'));
  }
}
doc_Drupal
2016-10-29 09:50:56
Comments
Leave a Comment

Please login to continue.