public function StyleswitcherConfigTheme::validateForm in Style Switcher 8.2
Same name and namespace in other branches
- 3.0.x src/Form/StyleswitcherConfigTheme.php \Drupal\styleswitcher\Form\StyleswitcherConfigTheme::validateForm()
Form validation 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 FormBase::validateForm
File
- src/
Form/ StyleswitcherConfigTheme.php, line 122
Class
- StyleswitcherConfigTheme
- Configure theme-specific styles settings.
Namespace
Drupal\styleswitcher\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
$theme = $form_state
->getValue('theme_name');
$values = $form_state
->getValue('settings');
// Automatically enable the default style and the style which was default
// previously because we will not get the value from that disabled checkbox.
$values['enabled'][$values['default']] = 1;
$values['enabled'][styleswitcher_default_style_key($theme)] = 1;
$form_state
->setValueForElement($form['settings'], $values);
}