function user_cookie_save in Drupal 9
Same name and namespace in other branches
- 8 core/modules/user/user.module \user_cookie_save()
- 7 modules/user/user.module \user_cookie_save()
Saves visitor information as a cookie so it can be reused.
Parameters
array $values: An array of key/value pairs to be saved into a cookie.
1 call to user_cookie_save()
- SystemController::compactPage in core/
modules/ system/ src/ Controller/ SystemController.php - Sets whether the admin menu is in compact mode or not.
File
- core/
modules/ user/ user.module, line 1137 - Enables the user registration and login system.
Code
function user_cookie_save(array $values) {
foreach ($values as $field => $value) {
// Set cookie for 365 days.
setrawcookie('Drupal.visitor.' . $field, rawurlencode($value), REQUEST_TIME + 31536000, '/');
}
}