og_preprocess_page

Versions
6
og_preprocess_page(&$variables)

Make group context available to javascript for ad tags and analytics.

Return value

void

Code

contributions/og/og.module, line 340

<?php
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";
  }
}
?>