public function ConfigDevelSettingsForm::validateForm in Configuration development 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/ ConfigDevelSettingsForm.php, line 54
Class
- ConfigDevelSettingsForm
- Settings form for config devel.
Namespace
Drupal\config_devel\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
foreach (array(
'auto_import',
'auto_export',
) as $key) {
$form_state
->setValue($key, array_filter(preg_split("/\r\n/", $form_state
->getValues()[$key])));
}
foreach ($form_state
->getValues()['auto_import'] as $file) {
$name = basename($file, '.' . FileStorage::getFileExtension());
if (in_array($name, array(
'system.site',
'core.extension',
'simpletest.settings',
))) {
$form_state
->setErrorByName('auto_import', $this
->t('@name is not compatible with this module', array(
'@name' => $name,
)));
}
}
parent::validateForm($form, $form_state);
}