function theme_tweetbutton_tweet_display in Tweet Button 8
Same name and namespace in other branches
- 7.2 tweetbutton.module \theme_tweetbutton_tweet_display()
Returns HTML for a tweet button.
Parameters
array $variables: An associative array with options of tweet button.
1 theme call to theme_tweetbutton_tweet_display()
- TweetbuttonTweetBlock::build in lib/
Drupal/ tweetbutton/ Plugin/ Block/ TweetbuttonTweetBlock.php - Implements \Drupal\block\BlockBase::blockBuild().
File
- ./
tweetbutton.module, line 184 - Adds block with tweet and follow buttons.
Code
function theme_tweetbutton_tweet_display($variables) {
$script_url = url('http://platform.twitter.com/widgets.js', array(
'external' => TRUE,
'https' => TRUE,
));
$options = $variables['options'];
$attributes = tweetbutton_tweet_get_attributes($options);
$tweetbutton_label = isset($options['tweetbutton_label']) ? $options['tweetbutton_label'] : t('Tweet');
$tweet_link = l($tweetbutton_label, 'http://twitter.com/share', array(
'attributes' => $attributes,
'external' => TRUE,
'https' => TRUE,
));
$link = array(
'#markup' => $tweet_link,
'#prefix' => '<div class="tweetbutton-tweet tweetbutton">',
'#suffix' => '</div>',
'#attached' => array(
'js' => array(
$script_url => array(
'type' => 'external',
'scope' => 'footer',
),
),
),
);
return drupal_render($link);
}