function user_cookie_save

Saves visitor information as a cookie so it can be reused.

Parameters

$values: An array of key/value pairs to be saved into a cookie.

3 calls to user_cookie_save()
CommentFormController::save in drupal/core/modules/comment/lib/Drupal/comment/CommentFormController.php
Overrides Drupal\Core\Entity\EntityFormController::save().
MessageFormController::save in drupal/core/modules/contact/lib/Drupal/contact/MessageFormController.php
Overrides Drupal\Core\Entity\EntityFormController::save().
system_admin_compact_page in drupal/core/modules/system/system.module
Menu callback; Sets whether the admin menu is in compact mode or not.

File

drupal/core/modules/user/user.module, line 2461
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, '/');
  }
}