Skip to content
Snippets Groups Projects
Commit cb7d92cd authored by Julian Pustkuchen's avatar Julian Pustkuchen
Browse files

Issue #3305446 by Anybody, Grevil: Config contains unexpected values after saving settings

parent 6aa4b468
No related branches found
No related tags found
No related merge requests found
......@@ -99,3 +99,16 @@ function photoswipe_requirements($phase) {
function photoswipe_update_8313() {
\Drupal::messenger()->addStatus('IMPORTANT: If you\'re already using the newly introduced "Photoswipe RESPONSIVE" field formatter, you have to set them manually AGAIN after this update. Regular photoswipe formatter is NOT affected. For details see #3271648.');
}
/**
* Remove unwanted config value from settings form: actions, form_build_id,
* form_token, form_id.
*/
function photoswipe_update_8314() {
\Drupal::configFactory()->getEditable('photoswipe.settings')
->clear('actions')
->clear('form_build_id')
->clear('form_token')
->clear('form_id')
->save();
}
......@@ -18,29 +18,22 @@ class PhotoswipeAdminSettings extends ConfigFormBase {
return 'photoswipe_admin_settings';
}
/**
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this->config('photoswipe.settings');
foreach (Element::children($form) as $variable) {
$config->set($variable, $form_state->getValue($form[$variable]['#parents']));
}
$config->save();
if (method_exists($this, '_submitForm')) {
$this->_submitForm($form, $form_state);
}
parent::submitForm($form, $form_state);
protected function getEditableConfigNames() {
return ['photoswipe.settings'];
}
/**
* {@inheritdoc}
*/
protected function getEditableConfigNames() {
return ['photoswipe.settings'];
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->config('photoswipe.settings')
->set('photoswipe_always_load_non_admin', $form_state->getValue('photoswipe_always_load_non_admin'))
->save();
parent::submitForm($form, $form_state);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment