You are here

public function UpdateManagerInstall::validateForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/update/src/Form/UpdateManagerInstall.php \Drupal\update\Form\UpdateManagerInstall::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

core/modules/update/src/Form/UpdateManagerInstall.php, line 129
Contains \Drupal\update\Form\UpdateManagerInstall.

Class

UpdateManagerInstall
Configure update settings for this site.

Namespace

Drupal\update\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $uploaded_file = $this
    ->getRequest()->files
    ->get('files[project_upload]', NULL, TRUE);
  if (!($form_state
    ->getValue('project_url') xor !empty($uploaded_file))) {
    $form_state
      ->setErrorByName('project_url', $this
      ->t('You must either provide a URL or upload an archive file to install.'));
  }
}