public function ConfigEditor::submitForm in Devel 8
Same name and namespace in other branches
- 8.3 src/Form/ConfigEditor.php \Drupal\devel\Form\ConfigEditor::submitForm()
- 8.2 src/Form/ConfigEditor.php \Drupal\devel\Form\ConfigEditor::submitForm()
- 4.x src/Form/ConfigEditor.php \Drupal\devel\Form\ConfigEditor::submitForm()
Form submission 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 FormInterface::submitForm
File
- src/
Form/ ConfigEditor.php, line 111
Class
- ConfigEditor
- Edit config variable form.
Namespace
Drupal\devel\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$values = $form_state
->getValues();
try {
$this
->configFactory()
->getEditable($values['name'])
->setData($values['parsed_value'])
->save();
drupal_set_message($this
->t('Configuration variable %variable was successfully saved.', array(
'%variable' => $values['name'],
)));
$this
->logger('devel')
->info('Configuration variable %variable was successfully saved.', array(
'%variable' => $values['name'],
));
$form_state
->setRedirectUrl(Url::fromRoute('devel.configs_list'));
} catch (\Exception $e) {
drupal_set_message($e
->getMessage(), 'error');
$this
->logger('devel')
->error('Error saving configuration variable %variable : %error.', array(
'%variable' => $values['name'],
'%error' => $e
->getMessage(),
));
}
}