function amp_context_context_load_alter in Accelerated Mobile Pages (AMP) 7
Implements hook_context_load_alter().
File
- modules/
amp_context/ amp_context.module, line 68 - Main module file.
Code
function amp_context_context_load_alter(&$context) {
if (!amp_is_amp_request()) {
return;
}
// Keep only contexts that have is_amp_request condition.
$disable_non_amp = variable_get('amp_context_disable_non_amp_contexts', TRUE);
if ($disable_non_amp && !isset($context->conditions['is_amp_request'])) {
// Condition not found, remove the context.
$context = new StdClass();
$context->name = NULL;
}
}