disclaimer.install in Disclaimer 7
Same filename and directory in other branches
Install and Uninstall processes for disclaimer.
File
disclaimer.installView source
<?php
/**
* @file
* Install and Uninstall processes for disclaimer.
*/
/**
* Create tables on install.
*/
function disclaimer_install() {
$t = get_t();
drupal_set_message($t('Please <a href="!url">configure your disclaimer</a>.', array(
'!url' => base_path() . 'admin/config/system/disclaimer',
)));
}
/**
* Implements hook_uninstall().
*/
function disclaimer_uninstall() {
// Delete all global variables.
db_delete('variable')
->condition('name', 'disclaimer_%', 'LIKE')
->execute();
}
/**
* Implements hook_requirements().
*/
function disclaimer_requirements($phase) {
$requirements = array();
$t = get_t();
$current_theme = variable_get('theme_default', NULL);
$regions = system_region_list($current_theme, REGIONS_VISIBLE);
if ($phase == 'install' && isset($regions['footer'])) {
variable_set('disclaimer_region', 'footer');
}
elseif ($phase == 'runtime' && !isset($regions[variable_get('disclaimer_region', NULL)])) {
$requirements['disclaimer'] = array(
'title' => $t('Disclaimer content'),
'description' => $t('Please <a href="!url">select a theme region</a> to handle disclaimer content.', array(
'!url' => url('admin/config/system/disclaimer'),
)),
'value' => $t('Region footer missing'),
'severity' => REQUIREMENT_ERROR,
);
}
return $requirements;
}
/**
* Set default region footer to handle disclaimer content.
*/
function disclaimer_update_7100(&$sandbox) {
$current_theme = variable_get('theme_default', NULL);
$regions = system_region_list($current_theme, REGIONS_VISIBLE);
if (isset($regions['footer'])) {
variable_set('disclaimer_region', 'footer');
}
}
Functions
Name | Description |
---|---|
disclaimer_install | Create tables on install. |
disclaimer_requirements | Implements hook_requirements(). |
disclaimer_uninstall | Implements hook_uninstall(). |
disclaimer_update_7100 | Set default region footer to handle disclaimer content. |