function theme_google_plusone_badge in Google Plus One Button | Google+ Badge 6
Same name and namespace in other branches
- 7 google_plusone.module \theme_google_plusone_badge()
Returns HTML for the Google +1 badge.
Parameters
$variables: An associative array containing:
- syntax: (optional) A string 'badge', 'smallbadge', 'smallicon', 'mediumicon', 'largeicon'
1 theme call to theme_google_plusone_badge()
- google_plusone_block in ./
google_plusone.module - Implements hook_block().
File
- ./
google_plusone.module, line 190
Code
function theme_google_plusone_badge($settings) {
google_plusone_add_js();
$page_id = variable_get('google_plusone_badge_page_id', '');
$size = 16;
// 'smallicon'
// Any other edge-case
switch ($settings['style']) {
case 'badge':
case 'smallbadge':
$syntax = 'HTML5';
// todo: provide option in block settings.
$tag_start = $syntax === 'g:plus' ? '<g:plus ' : '<div class="g-plus"';
$tag_end = $syntax === 'g:plus' ? '></g:plus>' : '></div>';
$badge = $tag_start . ' data-href="' . check_url($page_id) . '" data-size="' . check_plain($settings['style']) . '"' . $tag_end;
return $badge;
case 'smallicon':
$size = 16;
break;
case 'mediumicon':
$size = 32;
break;
case 'largeicon':
$size = 64;
break;
}
$badge = '<a href="' . check_url($page_id) . '/?prsrc=3" style="text-decoration: none;"><img src="https://ssl.gstatic.com/images/icons/gplus-' . $size . '.png" width="' . $size . '" height="' . $size . '" style="border: 0;"/></a>';
return $badge;
}