You are here

function fb_connect_theme_registry_alter in Drupal for Facebook 6.3

Same name and namespace in other branches
  1. 6.2 fb_connect.module \fb_connect_theme_registry_alter()
  2. 7.3 fb_connect.module \fb_connect_theme_registry_alter()

Implementation of hook_theme_registry_alter().

Override theme functions for things that can be displayed using XFBML. Currently overriding username and user_picture. We rename the original entries, as we will use them for users without javascript enabled.

This hook is not well documented. Who knows what its supposed to return? No doubt this will need updating with each new version of Drupal.

File

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

Code

function fb_connect_theme_registry_alter(&$theme_registry) {

  // Ideally, we'd do this only on themes which will certainly be used for facebook connect pages.
  if (variable_get(FB_CONNECT_VAR_THEME_USERNAME_2, TRUE) || variable_get(FB_CONNECT_VAR_THEME_USERNAME_1, TRUE) && $theme_registry['username']['type'] == 'module') {

    // Re-register the original theme function under a new name.
    $theme_registry['fb_connect_username_orig'] = $theme_registry['username'];

    // Override theme username
    $theme_registry['username'] = array(
      'arguments' => array(
        'object' => NULL,
      ),
      'function' => 'fb_connect_theme_username_override',
      'type' => 'module',
      'theme path' => array(),
    );
  }
  if (variable_get(FB_CONNECT_VAR_THEME_USERPIC_2, TRUE) || variable_get(FB_CONNECT_VAR_THEME_USERPIC_1, TRUE) && $theme_registry['user_picture']['type'] == 'module') {

    // Re-register the original theme function under a new name.
    $theme_registry['fb_connect_user_picture_orig'] = $theme_registry['user_picture'];

    // Override theme username
    $theme_registry['user_picture'] = array(
      'arguments' => array(
        'account' => NULL,
      ),
      'function' => 'fb_connect_theme_user_picture_override',
      'type' => 'module',
      'theme path' => array(),
    );
  }
}