You are here

function themekey_dummy2cookie in ThemeKey 7.3

Same name and namespace in other branches
  1. 7 modules/themekey.system.inc \themekey_dummy2cookie()
  2. 7.2 modules/themekey.system.inc \themekey_dummy2cookie()

ThemeKey mapping function to set a ThemeKey property's value (destination) with the aid of another ThemeKey property (source).

src: system:dummy dst: system:cookie

Parameters

$dummy: string containing current value of ThemeKey property system:dummy

Return value

array of system:cookie values or NULL if no value could be mapped

1 string reference to 'themekey_dummy2cookie'
themekey_system_themekey_properties in modules/themekey.system.inc
Implements hook_themekey_properties().

File

modules/themekey.system.inc, line 414
Provides some ThemeKey properties.

Code

function themekey_dummy2cookie($dummy) {
  $filtered_cookies = array();
  foreach ($_COOKIE as $key => $value) {
    if (!empty($value) && is_scalar($value)) {
      $filtered_cookies[] = $key . '=' . $value;
    }
    else {
      $filtered_cookies[] = $key;
    }
  }
  return count($filtered_cookies) ? array_unique($filtered_cookies) : NULL;
}