function themekey_dummy2session in ThemeKey 7.2
Same name and namespace in other branches
- 7.3 modules/themekey.system.inc \themekey_dummy2session()
- 7 modules/themekey.system.inc \themekey_dummy2session()
ThemeKey mapping function to set a ThemeKey property's value (destination) with the aid of another ThemeKey property (source).
src: system:dummy dst: system:session
Parameters
$dummy: string containing current value of ThemeKey property system:dummy
Return value
array of system:session values or NULL if no value could be mapped
1 string reference to 'themekey_dummy2session'
- themekey_system_themekey_properties in modules/
themekey.system.inc - Implements hook_themekey_properties().
File
- modules/
themekey.system.inc, line 668 - Provides some ThemeKey properties.
Code
function themekey_dummy2session($dummy) {
$filtered_params = array();
if (!empty($_SESSION)) {
foreach ($_SESSION as $key => $value) {
if (is_bool($value)) {
$filtered_params[] = $key . '=' . ($value ? '1' : '0');
}
elseif (!empty($value) && (is_numeric($value) || is_string($value))) {
$filtered_params[] = $key . '=' . $value;
}
else {
$filtered_params[] = $key;
}
}
}
return count($filtered_params) ? array_unique($filtered_params) : NULL;
}