You are here

function fbconnect_render_js in Facebook Connect 7.2

Same name and namespace in other branches
  1. 8.2 fbconnect.module \fbconnect_render_js()
  2. 6.2 fbconnect.module \fbconnect_render_js()
  3. 6 fbconnect.module \fbconnect_render_js()

This function manage all javascripts used by this module.

1 call to fbconnect_render_js()
fbconnect_login_init in fbconnect_login/fbconnect_login.module
Implements hook_init().

File

./fbconnect.module, line 307
Facebook Connect API module.

Code

function fbconnect_render_js() {
  global $user;
  $module_path = drupal_get_path('module', 'fbconnect');
  if ($config = fbconnect_get_config()) {
    unset($config['secret_api_key']);
    $config['fbuid'] = fbconnect_get_fbuid();
    $config['user'] = array(
      'uid' => $user->uid,
    );
    if (module_exists('fbconnect_login')) {
      $user->fbuid = _get_user_fbuid($user->uid);
      $config['fbuid'] = @$user->fbuid;
    }
    drupal_add_js(array(
      'fbconnect' => $config,
    ), array(
      'type' => 'setting',
      'scope' => JS_DEFAULT,
    ));
    drupal_add_js($module_path . '/fbconnect.js');
    drupal_add_css($module_path . '/fbconnect.css');
  }
}