You are here

function fb_connect_fb in Drupal for Facebook 6.2

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

Implementation of hook_fb().

File

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

Code

function fb_connect_fb($op, $data, &$return) {

  //dpm(func_get_args(), "fb_connect_fb($op)");
  if ($op == FB_OP_CURRENT_APP && !$return) {

    // This will cause fb.module to set the global $_fb when user is logged in via fbConnect.
    if ($label = variable_get(FB_CONNECT_VAR_PRIMARY, NULL)) {
      $return = fb_get_app(array(
        'label' => $label,
      ));
    }
  }
  elseif ($op == FB_OP_POST_INIT) {
    if ($label = variable_get(FB_CONNECT_VAR_PRIMARY, NULL)) {
      if ($data['fb_app']->label == $label && !fb_is_fbml_canvas()) {
        $fb_app = $data['fb_app'];

        // Init Facebook javascript for primary app
        fb_connect_require_feature('XFBML', $fb_app);

        // fb_connect_init_option('reloadIfSessionStateChanged', TRUE, $fb_app);
        fb_connect_init_option('ifUserConnected', "{FB_Connect.on_connected}", $fb_app);
        fb_connect_init_option('ifUserNotConnected', "{FB_Connect.on_not_connected}", $fb_app);
      }
    }

    // Include our admin hooks.
    if (fb_is_fb_admin_page()) {
      module_load_include('inc', 'fb_connect', 'fb_connect.admin');
    }
  }
  elseif ($op == FB_OP_CONNECT_JS_INIT) {
    foreach (fb_connect_init_js() as $js) {
      $return[] = $js;
    }
  }
}