class context_reaction_http_header in Context HTTP Headers 7
Expose http header changes as context reactions.
Hierarchy
- class \context_reaction
- class \context_reaction_http_header
Expanded class hierarchy of context_reaction_http_header
2 string references to 'context_reaction_http_header'
- context_http_headers_context_plugins in ./
context_http_headers.module - Implements hook_context_plugins().
- context_http_headers_context_registry in ./
context_http_headers.module - Implements hook_context_registry().
File
- ./
context_reaction_http_header.inc, line 5
View source
class context_reaction_http_header extends context_reaction {
function options_form($context) {
$values = $this
->fetch_from_context($context);
$items['http_header'] = array(
'#title' => t('HTTP Headers'),
'#tree' => 'tree',
);
// Retrieve hooked module data
$items_from_hook = module_invoke_all('context_http_header_def');
// Get set values from the context for these hooks
foreach ($items_from_hook as $header => $item) {
if (isset($values['http_header'][$header])) {
$items_from_hook[$header]['#default_value'] = $values['http_header'][$header];
}
}
$items['http_header'] = array_merge($items['http_header'], $items_from_hook);
return $items;
}
/**
* Public method that is called from hooks or other integration points.
*/
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);
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
context_reaction:: |
property | |||
context_reaction:: |
property | |||
context_reaction:: |
property | |||
context_reaction:: |
function | Retrieve options from the context provided. | 1 | |
context_reaction:: |
function | Retrieve active contexts that have values for this reaction. | ||
context_reaction:: |
function | Options form submit handler. | 3 | |
context_reaction:: |
function | Settings form. Provide variable settings for your reaction. | 2 | |
context_reaction:: |
function | Clone our references when we're being cloned. | ||
context_reaction:: |
function | Constructor. Do not override. | ||
context_reaction_http_header:: |
function | Public method that is called from hooks or other integration points. | ||
context_reaction_http_header:: |
function |
Overrides context_reaction:: |