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

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.