You are here

function session_cache_admin_config in Session Cache API 6

Same name and namespace in other branches
  1. 7 session_cache.admin.inc \session_cache_admin_config()

Menu callback for admin settings.

Contrib modules can add more options by implementing hook_form_alter().

1 string reference to 'session_cache_admin_config'
session_cache_menu in ./session_cache.module
Implements hook_menu().

File

./session_cache.admin.inc, line 13
session_cache.admin.inc

Code

function session_cache_admin_config() {
  $form['session_cache_storage_method'] = array(
    '#type' => 'radios',
    '#title' => t('Where should user session data be stored?'),
    '#default_value' => variable_get('session_cache_storage_method', SESSION_CACHE_STORAGE_SESSION),
    '#options' => array(
      SESSION_CACHE_STORAGE_COOKIE => t("on the user's computer, in a cookie"),
      SESSION_CACHE_STORAGE_DB_CORE => t("on the server, on core's cache database"),
      SESSION_CACHE_STORAGE_SESSION => t('on the server, in $_SESSION memory'),
    ),
    '#description' => t('The first two mechanisms will not create a $_SESSION or write to it so are generally a good choice when your site uses Varnish or similar caching engine.'),
  );
  $expire_period = (double) variable_get('session_cache_expire_period', 0.0);
  if ($expire_period <= 0.0) {
    $expire_period = SESSION_CACHE_DEFAULT_EXPIRATION_DAYS;
  }
  $form['session_cache_expire_period'] = array(
    '#type' => 'textfield',
    '#size' => 4,
    '#title' => t('Expiration time for the database cache and cookies created via this module'),
    '#field_suffix' => t('days'),
    '#default_value' => $expire_period,
    '#description' => t('You may use decimals, eg 0.25 equates to 6 hours.<br/>$_SESSION expiration is set via the server configuration. See the <em>sites/default/settings.php</em> file for details.'),
  );
  $form['session_cache_use_uid_as_sid'] = array(
    '#type' => 'checkbox',
    '#title' => t("Remember the user's session from one browser to the next"),
    '#default_value' => variable_get('session_cache_use_uid_as_sid', FALSE),
    '#description' => t('Applies to authenticated users only and does not work for the cookie and $_SESSION storage mechanisms.'),
  );
  return system_settings_form($form);
}