You are here

function og_preprocess_page in Organic groups 6.2

Same name and namespace in other branches
  1. 6 og.module \og_preprocess_page()

Preprocessor for Page template.

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

File

./og.module, line 483
Code for the Organic Groups module.

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