public function elFinderProfileForm::validate in elFinder file manager 8.2
File
- src/
Form/ elFinderProfileForm.php, line 337 - Contains \Drupal\elfinder\Form\elFinderProfileForm.
Class
- elFinderProfileForm
- Base form for elFinder Profile entities.
Namespace
Drupal\elfinder\FormCode
public function validate(array $form, FormStateInterface $form_state) {
$volumes = array();
foreach ($form_state
->getValue(array(
'conf',
'volumes',
)) as $i => $volume) {
$path = trim($volume['path']);
if ($path === '') {
continue;
}
}
if (!$volumes) {
return $form_state
->setError($form['conf']['volumes'][0]['path'], $this
->t('You must define a volume.'));
}
$form_state
->setValue(array(
'conf',
'volumes',
), array_values($volumes));
return parent::validate($form, $form_state);
}