protected function DefaultController::saveUserPreference in Style Switcher 8.2
Same name and namespace in other branches
- 3.0.x src/Controller/DefaultController.php \Drupal\styleswitcher\Controller\DefaultController::saveUserPreference()
Saves the style key to the cookie.
Parameters
string $theme_key: Name of the theme to save the style for.
string $style_key: Style key to save.
2 calls to DefaultController::saveUserPreference()
- DefaultController::activeStylePath in src/
Controller/ DefaultController.php - Finds the style active for current user and returns its path.
- DefaultController::styleswitcherSwitch in src/
Controller/ DefaultController.php - Switches style when JS is disabled.
File
- src/
Controller/ DefaultController.php, line 192
Class
- DefaultController
- Default controller for the styleswitcher module.
Namespace
Drupal\styleswitcher\ControllerCode
protected function saveUserPreference($theme_key, $style_key) {
$request_time = $this->time
->getRequestTime();
setcookie('styleswitcher[' . $theme_key . ']', $style_key, $request_time + STYLESWITCHER_COOKIE_EXPIRE, base_path());
}