function tweetbutton_follow_get_attributes in Tweet Button 8
Same name and namespace in other branches
- 7.2 tweetbutton.module \tweetbutton_follow_get_attributes()
- 7 tweetbutton.module \tweetbutton_follow_get_attributes()
Helper function to build attributes of follow button.
Parameters
array $options: Context specific options.
Return value
List of attributes to be rendered for follow button.
1 call to tweetbutton_follow_get_attributes()
- theme_tweetbutton_follow_display in ./
tweetbutton.module - Returns HTML for a follow button.
File
- ./
tweetbutton.module, line 134 - Adds block with tweet and follow buttons.
Code
function tweetbutton_follow_get_attributes($options) {
$language = \Drupal::languageManager()
->getCurrentLanguage();
$attributes = array(
'data-show-count' => $options['show_count'] ? 'true' : 'false',
'data-lang' => $options['lang'] == 'auto' ? $language->id : $options['lang'],
'data-width' => $options['width'] . 'px',
'data-show-screen-name' => $options['show_screen_name'] ? 'true' : 'false',
'data-size' => $options['size'],
'data-dnt' => $options['dnt'] ? 'true' : 'false',
'class' => 'twitter-follow-button',
);
if ($options['align'] !== 'none') {
$attributes['data-align'] = $options['align'];
}
return $attributes;
}