public static function ScssCompilerSystemPerformanceSettingsFormAlter::submit in SCSS/Less Compiler 8
Saves scss compiler settings on form submit.
File
- src/
Form/ ScssCompilerSystemPerformanceSettingsFormAlter.php, line 153
Class
- ScssCompilerSystemPerformanceSettingsFormAlter
- Adds compiler settings to the performance page.
Namespace
Drupal\scss_compiler\FormCode
public static function submit(&$form, FormStateInterface $form_state) {
$compilers = $form_state
->getValue('plugins');
foreach ($compilers as $key => $compiler) {
if ($compiler === 'none') {
unset($compilers[$key]);
}
}
\Drupal::service('config.factory')
->getEditable('scss_compiler.settings')
->set('cache', $form_state
->getValue('scss_cache'))
->set('sourcemaps', $form_state
->getValue('scss_sourcemaps'))
->set('output_format', $form_state
->getValue('scss_output_format'))
->set('check_modify_time', $form_state
->getValue('scss_check_modify_time'))
->set('plugins', $compilers)
->set('node_modules_path', $form_state
->getValue('node_modules_path'))
->set('flush_cache_type', $form_state
->getValue('flush_cache_type'))
->save();
}