google_plusone.install in Google Plus One Button | Google+ Badge 6
Same filename and directory in other branches
Enable and uninstall functions for the Google Plus One module.
File
google_plusone.installView source
<?php
/**
* @file
* Enable and uninstall functions for the Google Plus One module.
*/
/**
* Implements hook_enable().
*/
function google_plusone_enable() {
$node_types = variable_get('google_plusone_node_types', array());
if (empty($node_types)) {
drupal_set_message(t('To finish enabling Google +1 button in your nodes, visit the <a href="@settings">settings</a> page. And remember to check the <a href="@perm">permissions</a> to view the button.', array(
'@settings' => url('admin/settings/google-plusone'),
'@perm' => url('admin/user/permissions', array(
'fragment' => 'module-google_plusone',
)),
)));
}
}
/**
* Implements hook_uninstall().
*/
function google_plusone_uninstall() {
variable_del('google_plusone_node_types');
variable_del('google_plusone_node_location');
variable_del('google_plusone_weight');
variable_del('google_plusone_showonteasers');
variable_del('google_plusone_block_settings');
variable_del('google_plusone_button_settings');
variable_del('google_plusone_advanced_settings');
}
/**
* 'count' parameter has been deprecated in favor of 'annotation' in the Google +1 API
* Updating variables according to the new API.
*/
function google_plusone_update_6001() {
$ret = array();
// Updating settings of the G+ button for the node
$button_settings = variable_get('google_plusone_button_settings', 0);
if (isset($button_settings['count'])) {
$button_settings['annotation'] = $button_settings['count'] ? 'none' : 'bubble';
$button_settings['width'] = '250';
unset($button_settings['count']);
variable_set('google_plusone_button_settings', $button_settings);
}
// Same for the block settings
$block_settings = variable_get('google_plusone_block_settings', 0);
if (isset($block_settings['count'])) {
$block_settings['annotation'] = $button_settings['count'] ? 'none' : 'bubble';
$block_settings['width'] = '250';
if (empty($block_settings['url'])) {
$block_settings['url'] = '<front>';
}
unset($block_settings['count']);
variable_set('google_plusone_block_settings', $block_settings);
}
$ret[] = array(
'success' => TRUE,
'query' => 'Upgraded settings according to the new Google +1 button API',
);
return $ret;
}
Functions
Name![]() |
Description |
---|---|
google_plusone_enable | Implements hook_enable(). |
google_plusone_uninstall | Implements hook_uninstall(). |
google_plusone_update_6001 | 'count' parameter has been deprecated in favor of 'annotation' in the Google +1 API Updating variables according to the new API. |