public function GridStackSettingsForm::submitForm in GridStack 8.2
Same name and namespace in other branches
- 8 modules/gridstack_ui/src/Form/GridStackSettingsForm.php \Drupal\gridstack_ui\Form\GridStackSettingsForm::submitForm()
Implements \Drupal\Core\Form\FormInterface::submitForm().
Overrides ConfigFormBase::submitForm
File
- modules/
gridstack_ui/ src/ Form/ GridStackSettingsForm.php, line 237
Class
- GridStackSettingsForm
- Defines the GridStack admin settings form.
Namespace
Drupal\gridstack_ui\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this->configFactory
->getEditable('gridstack.settings');
foreach (array_keys(GridStackDefault::uiSettings()) as $key) {
$config
->set($key, $form_state
->getValue($key));
}
$config
->save();
// Invalidate the library discovery cache to update new assets.
$this->libraryDiscovery
->clearCachedDefinitions();
$this->configFactory
->clearStaticCache();
// If anything fails, notice to clear the cache.
$this
->messenger()
->addMessage($this
->t('Be sure to <a href=":clear_cache">clear the cache</a> <strong>ONLY IF</strong> trouble to see the updated libraries.', [
':clear_cache' => Url::fromRoute('system.performance_settings')
->toString(),
]));
parent::submitForm($form, $form_state);
}