function og_preprocess_page in Organic groups 6
Same name and namespace in other branches
- 6.2 og.module \og_preprocess_page()
Make group context available to javascript for ad tags and analytics.
Return value
void
File
- ./
og.module, line 331
Code
function og_preprocess_page(&$variables) {
if ($group_node = og_get_group_context()) {
$data = array(
'og' => array(
'group_context' => array(
'nid' => $group_node->nid,
'title' => $group_node->title,
'type' => $group_node->type,
),
),
);
drupal_add_js($data, 'setting');
$variables['scripts'] = drupal_get_js();
$variables['body_classes'] .= " og-context og-context-{$group_node->nid}";
}
}