You are here

function twitter_signin_block in Twitter 6.5

Same name and namespace in other branches
  1. 6.3 twitter_signin/twitter_signin.module \twitter_signin_block()
  2. 6.4 twitter_signin/twitter_signin.module \twitter_signin_block()

Implementation of hook_block().

File

twitter_signin/twitter_signin.module, line 36
Hook implementations for twitter_signin submodule.

Code

function twitter_signin_block($op = 'list', $delta = 0, $edit = array()) {
  switch ($op) {
    case 'list':
      $block[0]['info'] = t('Sign in with Twitter');
      return $block;
    case 'view':

      // Don't do anything if the credentials haven't been set up yet.
      $key = variable_get('twitter_consumer_key', '');
      $secret = variable_get('twitter_consumer_secret', '');
      if (empty($key) || empty($secret)) {
        return;
      }
      global $user;
      $block['subject'] = t('Sign in with Twitter');
      $block['content'] = twitter_signin_button();
      return $block;
  }
}