You are here

function fb_connect_require_feature in Drupal for Facebook 5.2

Same name and namespace in other branches
  1. 6.2 fb_connect.module \fb_connect_require_feature()

Allows other modules to specify which Facebook Connect features are required. This will affect how the FB_RequireFeatures javascript method is called.

3 calls to fb_connect_require_feature()
fb_connect_block in ./fb_connect.module
Implementation of hook_block.
fb_connect_fb in ./fb_connect.module
Implementation of hook_fb().
fb_connect_footer in ./fb_connect.module
Include facebook javascript in the footer of the current page.

File

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

Code

function fb_connect_require_feature($feature = NULL, $fb_app = NULL) {
  if ($feature && !isset($fb_app)) {
    $fb_app = $GLOBALS['fb_app'];
  }

  // some features may apply without an app, but for now let's enforce that an app is required.
  if ($feature && !$fb_app) {
    return;
  }
  static $features;
  if (!$features) {
    $features = array();
  }
  if ($fb_app && !$features[$fb_app->apikey]) {
    $features[$fb_app->apikey] = array(
      'fb_app' => $fb_app,
      'features' => array(),
    );
  }
  if ($feature) {
    $features[$fb_app->apikey]['features'][$feature] = $feature;
  }
  return $features;
}