You are here

function theme_fbconnect_login_button in Facebook Connect 8.2

Same name and namespace in other branches
  1. 6.2 fbconnect.module \theme_fbconnect_login_button()
  2. 7.2 fbconnect_login/fbconnect_login.module \theme_fbconnect_login_button()

Theme function for Facebook connect/login button.

1 theme call to theme_fbconnect_login_button()
fbconnect_login_render_button in fbconnect_login/fbconnect_login.module
Render a custom button to log in via Facebook.

File

fbconnect_login/fbconnect_login.module, line 648
Login functionality for Facebook Connect module

Code

function theme_fbconnect_login_button($variables) {
  $op = $variables['op'];
  $user_profile = $variables['user_profile'];
  $text = $variables['text'];
  $attr = $variables['attr'];
  $attr['data-scope'] = 'email';
  $destination = request_path();
  if ($op == 'login') {
    $title = t('Hello %name', array(
      '%name' => $user_profile['name'],
    ));
    $desc = t('Login to this site using your Facebook credentials.');
    $link = l('<span class="fb_button_text">' . $text . '</span>', 'fbconnect/authorize', array(
      'query' => array(
        'fb-destination' => $destination,
      ),
      'html' => TRUE,
      'attributes' => array(
        'class' => array(
          'fb_button fb_button_' . $attr['size'],
        ),
      ),
    ));
    return '<h3>' . $title . '</h3>' . $desc . $link;
  }
  else {
    $url = url('fbconnect/authorize', array(
      'absolute' => TRUE,
      'query' => array(
        'fb-destination' => $destination,
      ),
    ));
    $button = '<fb:login-button onlogin="window.location.href = \'' . $url . '\'" ' . drupal_attributes($attr) . '>' . $text . '</fb:login-button>';
    return $button;
  }
}