function fb_js_settings in Drupal for Facebook 6.3
Same name and namespace in other branches
- 7.3 fb.module \fb_js_settings()
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_footer in ./
fb.module - Implements hook_footer().
- fb_init in ./
fb.module - Implements hook_init().
- fb_user_fb in ./
fb_user.module - Implementation of 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 342 - This is the core required module of Drupal for Facebook.
Code
function fb_js_settings($key = NULL, $value = NULL) {
static $fb_js_settings = array();
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;
}
}