You are here

function themekey_dummy2http_header in ThemeKey 7.3

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

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

src: system:dummy dst: system:http_header

Parameters

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

Return value

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

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

File

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

Code

function themekey_dummy2http_header($dummy) {
  $filtered_headers = array();
  if (function_exists('apache_request_headers')) {

    // Function apache_request_headers() is only available when PHP runs as an Apache module.
    // P.e. when running drush, it's not available
    foreach (apache_request_headers() as $key => $value) {
      $filtered_headers[] = $key . (!empty($value) ? '=' . $value : '');
    }
  }
  return count($filtered_headers) ? array_unique($filtered_headers) : NULL;
}