public function PhotosDirectoryImportForm::validateForm in Album Photos 8.4
Same name and namespace in other branches
- 8.5 src/Form/PhotosDirectoryImportForm.php \Drupal\photos\Form\PhotosDirectoryImportForm::validateForm()
- 6.0.x src/Form/PhotosDirectoryImportForm.php \Drupal\photos\Form\PhotosDirectoryImportForm::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/ PhotosDirectoryImportForm.php, line 172
Class
- PhotosDirectoryImportForm
- Defines a form to upload photos to this site.
Namespace
Drupal\photos\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
$directory = $form_state
->getValue('directory');
// Check if directory exists.
if (!empty($directory) && !is_dir($directory)) {
return $form_state
->setErrorByName('directory', $this
->t('Could not find directory. Please check the path.'));
}
}