You are here

function og_context_add_js in Organic groups 7.2

Same name and namespace in other branches
  1. 7 og_context/og_context.module \og_context_add_js()

Add the group entity of the context to the Drupal javascript entity.

Parameters

$context: The context array.

1 call to og_context_add_js()
og_context_preprocess_html in og_context/og_context.module
Implement hook_preprocess_html().

File

og_context/og_context.module, line 299
Get a group from a viewed page.

Code

function og_context_add_js($context) {

  // Static variable to indicate if group was already added to javascript.
  $js =& drupal_static(__FUNCTION__, FALSE);
  if (!$js) {
    drupal_add_js(array(
      'ogContext' => array(
        'groupType' => $context['group_type'],
        'gid' => $context['gid'],
      ),
    ), 'setting');
    $js = TRUE;
  }
}