public function DropzoneJsEbWidget::validateConfigurationForm in DropzoneJS 8.2
Same name and namespace in other branches
- 8 modules/eb_widget/src/Plugin/EntityBrowser/Widget/DropzoneJsEbWidget.php \Drupal\dropzonejs_eb_widget\Plugin\EntityBrowser\Widget\DropzoneJsEbWidget::validateConfigurationForm()
File
- modules/
eb_widget/ src/ Plugin/ EntityBrowser/ Widget/ DropzoneJsEbWidget.php, line 519
Class
- DropzoneJsEbWidget
- Provides an Entity Browser widget that uploads new files.
Namespace
Drupal\dropzonejs_eb_widget\Plugin\EntityBrowser\WidgetCode
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
$values = $form_state
->getValues()['table'][$this
->uuid()]['form'];
if (!empty($values['extensions'])) {
$extensions = explode(' ', $values['extensions']);
$fail = FALSE;
foreach ($extensions as $extension) {
if (preg_match('%^\\w*$%', $extension) !== 1) {
$fail = TRUE;
}
}
if ($fail) {
$form_state
->setErrorByName('extensions', $this
->t('Invalid extension list format.'));
}
}
}