Implements hook_block_view_alter().
File
-
./
advagg.module, line 419
Code
function advagg_block_view_alter(&$data, $block) {
// Do not run hook if AdvAgg is disabled.
if (!advagg_enabled()) {
return;
}
// Do not run hook if setting is disabled.
if (!variable_get('advagg_scripts_scope_anywhere', ADVAGG_SCRIPTS_SCOPE_ANYWHERE)) {
return;
}
if (empty($data) || empty($data['content'])) {
return;
}
$block_info = $block->module . ':' . $block->delta;
$prefix = "<!-- AdvAgg block:prefix:{$block_info} tag -->";
$suffix = "<!-- AdvAgg block:suffix:{$block_info} tag -->";
if (is_string($data['content'])) {
$data['content'] = $prefix . $data['content'] . $suffix;
}
else {
if (!isset($data['content']['#prefix'])) {
$data['content']['#prefix'] = '';
}
$data['content']['#prefix'] .= $prefix;
if (!isset($data['content']['#suffix'])) {
$data['content']['#suffix'] = '';
}
$data['content']['#suffix'] .= $suffix;
}
}