You are here

function context_http_headers_context_http_header_build in Context HTTP Headers 7

Implements hook_context_http_headers_build().

Should return array in the format of: array( 'header-1' => array('value1', 'value2', etc), 'header-2' => array(...), )

File

./context_http_headers.module, line 30
Adds HTTP Header reaction to Context

Code

function context_http_headers_context_http_header_build($http_header_items) {
  $keyed_headers = array();
  if ($http_header_items['extra_headers']) {
    $extra_headers = explode("\n", $http_header_items['extra_headers']);
    $values = array();
    foreach ($extra_headers as $extra_header) {
      list($header, $value) = explode(":", $extra_header);
      $keyed_headers[$header][] = trim($value);
    }
  }
  return $keyed_headers;
}