You are here

function _fb_connect_add_js in Drupal for Facebook 6.2

Same name and namespace in other branches
  1. 6.3 fb_connect.module \_fb_connect_add_js()
  2. 7.3 fb_connect.module \_fb_connect_add_js()

This wrapper function around drupal_add_js() ensures that our settings are added once and only once when needed.

1 call to _fb_connect_add_js()
fb_connect_require_feature in ./fb_connect.module
Allows other modules to specify which Facebook Connect features are required. This will affect how the FB_RequireFeatures javascript method is called.

File

./fb_connect.module, line 264
Support for Facebook Connect features

Code

function _fb_connect_add_js() {
  static $just_once;
  if (!isset($just_once)) {
    if ($uid = $GLOBALS['user']->uid && module_exists('fb_user')) {
      $session_start_url = url(FB_CONNECT_PATH_SESSION_START, array(
        'absolute' => TRUE,
      ));
    }
    drupal_add_js(array(
      'fb_connect' => array(
        'front_url' => url('<front>'),
        'fbu' => fb_facebook_user(),
        'uid' => $uid,
        'in_iframe' => fb_is_iframe_canvas(),
        'session_start_url' => $session_start_url,
        'session_end_url' => url(FB_CONNECT_PATH_SESSION_END, array(
          'absolute' => TRUE,
        )),
      ),
    ), 'setting');
    drupal_add_js(drupal_get_path('module', 'fb_connect') . '/fb_connect.js');
    $just_once = TRUE;
  }
}