You are here

function fb_custom_theme in Drupal for Facebook 7.3

Implements hook_custom_theme().

hook_custom_theme() is the new hook_init(). It is called before hook_init(), and therefore the first opportunity that a module has to act. Although this module is not interested in setting a custom theme, fb_canvas and fb_tab might, so we must initialize some data here.

This function is also called before node_access hooks. So the more we can initialize here, the better. That's why we initialize both $_fb_app and $_fb.

See also

fb_canvas_custom_theme().

fb_init().

1 call to fb_custom_theme()
fb_init in ./fb.module
Implements hook_init().

File

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

Code

function fb_custom_theme() {

  // The code here is conceptually part of fb_init().
  global $_fb_app;
  global $_fb;

  // fb_settings.inc may have been included in settings.php. If not, include it now.
  if (!function_exists('fb_settings')) {
    module_load_include('inc', 'fb', 'fb_settings');

    // trigger test in fb_devel.module
    $GLOBALS['fb_init_no_settings'] = TRUE;
  }

  // Figure out which app the current request is for.
  $_fb_app = fb_invoke(FB_OP_CURRENT_APP);
  if ($_fb_app) {

    // Initialize the PHP API.
    $_fb = fb_api_init($_fb_app);
  }
}