colorbox.install in Colorbox 7
Same filename and directory in other branches
Install, update and uninstall functions for the colorbox module.
File
colorbox.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the colorbox module.
*/
/**
* Implements hook_requirements().
*/
function colorbox_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
$t = get_t();
$library_path = colorbox_get_path();
$colorbox_version = colorbox_get_version();
if (version_compare($colorbox_version, COLORBOX_MIN_PLUGIN_VERSION, '>=')) {
$requirements['colorbox_plugin'] = array(
'title' => $t('Colorbox plugin'),
'severity' => REQUIREMENT_OK,
'value' => $colorbox_version,
);
}
else {
$requirements['colorbox_plugin'] = array(
'title' => $t('Colorbox plugin'),
'value' => $t('At least @a', array(
'@a' => COLORBOX_MIN_PLUGIN_VERSION,
)),
'severity' => REQUIREMENT_ERROR,
'description' => $t('You need to download the !colorbox and extract the entire contents of the archive into the %path folder of your server.', array(
'!colorbox' => l(t('Colorbox plugin'), 'https://github.com/jackmoore/colorbox/archive/1.x.zip'),
'%path' => $library_path,
)),
);
}
}
return $requirements;
}
/**
* Implements hook_uninstall().
*/
function colorbox_uninstall() {
db_query("DELETE FROM {variable} WHERE name LIKE 'colorbox_%'");
}
/**
* Delete the unused colorbox_login_form variable.
*/
function colorbox_update_7001() {
$ret = array();
variable_del('colorbox_login_form');
return $ret;
}
/**
* Delete the unused colorbox_title_trim and
* colorbox_title_trim_length variables.
*/
function colorbox_update_7002() {
$ret = array();
$colorbox_title_trim = variable_get('colorbox_title_trim', NULL);
$colorbox_title_trim_length = variable_get('colorbox_title_trim_length', NULL);
if (!empty($colorbox_title_trim)) {
variable_set('colorbox_caption_trim', $colorbox_title_trim);
}
if (!empty($colorbox_title_trim_length)) {
variable_set('colorbox_caption_trim_length', $colorbox_title_trim_length);
}
variable_del('colorbox_title_trim');
variable_del('colorbox_title_trim_length');
return $ret;
}
Functions
Name | Description |
---|---|
colorbox_requirements | Implements hook_requirements(). |
colorbox_uninstall | Implements hook_uninstall(). |
colorbox_update_7001 | Delete the unused colorbox_login_form variable. |
colorbox_update_7002 | Delete the unused colorbox_title_trim and colorbox_title_trim_length variables. |