You are here

function fb_js_settings in Drupal for Facebook 7.3

Same name and namespace in other branches
  1. 6.3 fb.module \fb_js_settings()

Helper to get the configured variables.

Adds the javascript setting with the supplied key/value. This function merely keeps track of the settings and writes them as late as possible. Currently, in the fb_footer() function. There has been a lot of experimentation as to the best place to initialize the facebook javascript SDK. The footer appears to be the best place because we may not know all settings until well after hook_init().

Parameters

$key: The javascript setting name. If the key is null then nothing is modified and the settings are returned.

$value: The value of the javascript setting. If the key is not NULL by the value is the setting is removed

Return value

The associative array containing the current fb javascript settings

5 calls to fb_js_settings()
fb_channel_page in ./fb.module
Menu callback for custom channel.
fb_init in ./fb.module
Implements hook_init().
fb_page_alter in ./fb.module
Implements hook_page_alter(). Can alter the $page['page_bottom'] hidden region here.
fb_user_fb in ./fb_user.module
Implements hook_fb.
_fb_connect_add_js in ./fb_connect.module
This wrapper function around drupal_add_js() ensures that our settings are added once and only once when needed.

File

./fb.module, line 428
This is the core required module of Drupal for Facebook.

Code

function fb_js_settings($key = NULL, $value = NULL) {
  $fb_js_settings =& drupal_static(__FUNCTION__);
  if (isset($key) && isset($value)) {
    $fb_js_settings[$key] = $value;
    return $value;
  }
  elseif (isset($key)) {
    return isset($fb_js_settings[$key]) ? $fb_js_settings[$key] : NULL;
  }
  else {
    return $fb_js_settings;
  }
}