You are here

function context_reaction_http_header::execute in Context HTTP Headers 7

Public method that is called from hooks or other integration points.

File

./context_reaction_http_header.inc, line 32

Class

context_reaction_http_header
Expose http header changes as context reactions.

Code

function execute() {
  $contexts = $this
    ->get_contexts();
  foreach ($contexts as $context) {
    $http_header_items = $context->reactions['http_header']['http_header'];
    $header_builds = module_invoke_all('context_http_header_build', $http_header_items);

    // Query the headers and from context and inserts it into the conditioned pages
    $headers = _context_http_headers_header_map($header_builds);

    // add headers to the page
    foreach ($headers as $key => $value) {
      drupal_add_http_header($key, $value);
    }
  }
}