function google_plusone_block_view in Google Plus One Button | Google+ Badge 7
Implements hook_block_view().
File
- ./
google_plusone.module, line 367
Code
function google_plusone_block_view($delta = '') {
if (user_access('view google plusone')) {
$block = array();
switch ($delta) {
case 'google_plusone_block':
$default = array(
'url' => '',
'annotation' => 'bubble',
'width' => '250',
'size' => '',
// standard
'css' => 'text-align:center;',
'alias' => 'aliased',
);
// Block settings inherits first the settings from the general button settings.
$settings = array_merge($default, variable_get('google_plusone_button_settings', array()));
$settings = array_merge($settings, variable_get('google_plusone_block_settings', array()));
$block['subject'] = NULL;
$block['content'] = theme('google_plusone_button__block', $settings);
return $block;
case 'google_plusone_badge_block':
$page_id = variable_get('google_plusone_badge_page_id', '');
$link = array(
'#tag' => 'link',
// The #tag is the html tag - <link />
'#attributes' => array(
// Set up an array of attributes inside the tag
'href' => check_url($page_id),
'rel' => 'publisher',
),
);
drupal_add_html_head($link, 'google_plusone_badge_page_id');
$settings = array(
'page_id' => $page_id,
'style' => variable_get('google_plusone_badge_style', 'standardbadge'),
'width' => variable_get('google_plusone_badge_width', '300'),
'theme' => variable_get('google_plusone_badge_theme', 'light'),
'custom_name' => variable_get('google_plusone_badge_custom_name', ''),
);
$block['subject'] = NULL;
$block['content'] = theme('google_plusone_badge__block', $settings);
return $block;
}
}
}