public function RedirectImportForm::validateForm in Path redirect import 8
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/ RedirectImportForm.php, line 122
Class
- RedirectImportForm
- Class RedirectImportForm.
Namespace
Drupal\path_redirect_import\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
$this->file = file_save_upload('csv_file', $form['csv']['csv_file']['#upload_validators'], FALSE, 0);
// Ensure we have the file uploaded.
if (!$this->file) {
$form_state
->setErrorByName('csv_file', $this
->t('You must add a valid file to the form in order to import redirects.'));
}
}