You are here

function theme_tweetbutton_hashtag_display in Tweet Button 8

Same name and namespace in other branches
  1. 7.2 tweetbutton.module \theme_tweetbutton_hashtag_display()

Returns HTML for a hashtag.

Parameters

array $variables: An associative array with options of hashtag.

File

./tweetbutton.module, line 253
Adds block with tweet and follow buttons.

Code

function theme_tweetbutton_hashtag_display($variables) {
  $script_url = url('http://platform.twitter.com/widgets.js', array(
    'external' => TRUE,
  ));
  $options = $variables['options'];
  $attributes = tweetbutton_hashtag_get_attributes($options);
  $query = array();
  if (!empty($options['tweet_text'])) {
    $query['tweet_text'] = $options['tweet_text'];
  }
  if (!empty($variables['hashtag'])) {
    $query['button_hashtag'] = $variables['hashtag'];
  }
  $hash_link = l($hash_text, 'http://twitter.com/intent/tweet', array(
    'query' => $query,
    'attributes' => $attributes,
    'external' => TRUE,
    'https' => TRUE,
  ));
  $hash_link = array(
    '#markup' => $hash_link,
    '#prefix' => '<div class="tweetbutton-hashtag tweetbutton">',
    '#suffix' => '</div>',
    '#attached' => array(
      'js' => array(
        $script_url => array(
          'type' => 'external',
          'scope' => 'footer',
        ),
      ),
    ),
  );
  return drupal_render($hash_link);
}