function browsersync_theme_settings_form_submit in Browsersync 8
Same name and namespace in other branches
- 8.2 browsersync.module \browsersync_theme_settings_form_submit()
Form submission handler for theme settings form.
See also
browsersync_form_system_theme_settings_alter()
1 string reference to 'browsersync_theme_settings_form_submit'
File
- ./
browsersync.module, line 116 - Code for the Browsersync module.
Code
function browsersync_theme_settings_form_submit($form, FormStateInterface $form_state) {
$args = $form_state
->getBuildInfo()['args'];
$theme_key = !empty($args[0]) ? $args[0] : NULL;
if ($theme_key) {
$config_key = $theme_key . '.settings';
}
else {
$config_key = 'system.theme.global';
}
$user_input = $form_state
->getUserInput();
\Drupal::configFactory()
->getEditable($config_key)
->set('third_party_settings.browsersync.enabled', $user_input['browsersync_enabled'])
->set('third_party_settings.browsersync.host', $user_input['browsersync_host'])
->set('third_party_settings.browsersync.port', $user_input['browsersync_port'])
->save();
}