Allow other modules to swap important contextual information on generation.
Paramètres
array $original: Array of original settings.
array $aggregate_settings: Array of contextual settings.
int $mode: Use 0 to change context to what is inside of $aggregate_settings. Use 1 to change context back.
Voir aussi
Sujets associés
1 function implements hook_advagg_context_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- advagg_advagg_context_alter dans ./
advagg.advagg.inc - Implements hook_advagg_context_alter().
1 invocation of hook_advagg_context_alter()
- advagg_context_switch dans ./
advagg.inc - Changes context when generating CSS or JS files.
Fichier
-
./
advagg.api.php, line 542
Code
function hook_advagg_context_alter(array &$original, array $aggregate_settings, $mode) {
if ($mode == 0) {
// Change context.
$original['base_root'] = $GLOBALS['base_root'];
$original['base_url'] = $GLOBALS['base_url'];
$original['base_path'] = $GLOBALS['base_path'];
$original['is_https'] = $GLOBALS['is_https'];
$GLOBALS['is_https'] = $aggregate_settings['variables']['is_https'];
if ($aggregate_settings['variables']['is_https']) {
$GLOBALS['base_root'] = str_replace('http://', 'https://', $GLOBALS['base_root']);
$GLOBALS['base_url'] = str_replace('http://', 'https://', $GLOBALS['base_url']);
}
else {
$GLOBALS['base_root'] = str_replace('https://', 'http://', $GLOBALS['base_root']);
$GLOBALS['base_url'] = str_replace('https://', 'http://', $GLOBALS['base_url']);
}
$GLOBALS['base_path'] = $aggregate_settings['variables']['base_path'];
}
elseif ($mode == 1) {
// Change context back.
if (isset($original['base_root'])) {
$GLOBALS['base_root'] = $original['base_root'];
}
if (isset($original['base_url'])) {
$GLOBALS['base_url'] = $original['base_url'];
}
if (isset($original['base_path'])) {
$GLOBALS['base_path'] = $original['base_path'];
}
if (isset($original['is_https'])) {
$GLOBALS['is_https'] = $original['is_https'];
}
}
}