3 namespace Drupal\slick_ui\Form;
5 use Drupal\Core\Form\ConfigFormBase;
6 use Drupal\Core\Form\FormStateInterface;
9 * Defines the Slick admin settings form.
11 class SlickSettingsForm extends ConfigFormBase {
16 public function getFormId() {
17 return 'slick_settings_form';
23 protected function getEditableConfigNames() {
24 return ['slick.settings'];
28 * Implements \Drupal\Core\Form\FormInterface::buildForm().
30 public function buildForm(array $form, FormStateInterface $form_state) {
31 $config = $this->config('slick.settings');
33 $form['module_css'] = [
34 '#type' => 'checkbox',
35 '#title' => $this->t('Enable Slick module slick.theme.css'),
36 '#description' => $this->t('Uncheck to permanently disable the module slick.theme.css, normally included along with skins.'),
37 '#default_value' => $config->get('module_css'),
38 '#prefix' => $this->t("Note! Slick doesn't need Slick UI to run. It is always safe to uninstall Slick UI once done with optionsets."),
41 $form['slick_css'] = [
42 '#type' => 'checkbox',
43 '#title' => $this->t('Enable Slick library slick-theme.css'),
44 '#description' => $this->t('Uncheck to permanently disable the optional slick-theme.css, normally included along with skins.'),
45 '#default_value' => $config->get('slick_css'),
48 return parent::buildForm($form, $form_state);
52 * Implements \Drupal\Core\Form\FormInterface::submitForm().
54 public function submitForm(array &$form, FormStateInterface $form_state) {
56 $this->configFactory->getEditable('slick.settings')
57 ->set('slick_css', $form_state->getValue('slick_css'))
58 ->set('module_css', $form_state->getValue('module_css'))
61 // Invalidate the library discovery cache to update new assets.
62 \Drupal::service('library.discovery')->clearCachedDefinitions();
64 parent::submitForm($form, $form_state);