vertical_tabs.install in Vertical Tabs 6
Install, update and uninstall functions for the vertical_tabs module.
File
vertical_tabs.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the vertical_tabs module.
*/
/**
* Implement hook_install().
*/
function vertical_tabs_install() {
// Make this module's weight heavy so it runs after most form alterations.
db_query("UPDATE {system} SET weight = 300 WHERE type = 'module' AND name = 'vertical_tabs'");
}
/**
* Implement hook_enable().
*/
function vertical_tabs_enable() {
// Generate color stylesheet.
vertical_tabs_install_color_generate();
}
/**
* Implement hook_uninstall().
*/
function vertical_tabs_uninstall() {
variable_del('vertical_tabs_forms');
variable_del('vertical_tabs_default');
variable_del('vertical_tabs_minimum');
}
/**
* Reduce the module weight and remove the form settings variable.
*/
function vertical_tabs_update_6100() {
$ret = array();
$ret[] = update_sql("UPDATE {system} SET weight = 300 WHERE type = 'module' AND name = 'vertical_tabs'");
variable_del('vertical_tabs_settings_form');
return $ret;
}
/**
* Color-enable the module if using Garland.
*/
function vertical_tabs_update_6101() {
vertical_tabs_install_color_generate();
return array();
}
/**
* Regenerate the stylesheets if using Garland to accomidate for CSS changes.
*/
function vertical_tabs_update_6102() {
vertical_tabs_install_color_generate();
return array();
}
/**
* Remove any variables of deleted node types.
*/
function vertical_tabs_update_6103() {
$query = db_query("SELECT name FROM {variable} WHERE name LIKE 'vertical_tabs_fieldsets_%%'");
$node_types = node_get_types('names');
while ($variable = db_result($query)) {
$node_type = substr($variable, 24);
if (!isset($node_types[$node_type])) {
variable_del($variable);
}
}
return array();
}
/**
* Delete the node type fieldset configurations.
*/
function vertical_tabs_update_6104() {
$config = variable_get('vertical_tabs_forms', array());
$node_types = array_keys(node_get_types('names'));
foreach ($node_types as $node_type) {
$node_type_setting = 'vertical_tabs_fieldsets_' . $node_type;
if (!variable_get($node_type_setting, array())) {
$config[$node_type . '_node_form'] = FALSE;
}
variable_del($node_type_setting);
}
variable_set('vertical_tabs_forms', $config);
return array();
}
/**
* Initialize the color-enabled stylesheet if using Garland.
*/
function vertical_tabs_install_color_generate() {
if (variable_get('theme_default', 'garland') == 'garland' || variable_get('admin_theme', '0') == 'garland') {
if (module_exists('color')) {
$theme = 'garland';
$info = color_get_info($theme);
$palette = color_get_palette($theme);
drupal_load('module', 'vertical_tabs');
vertical_tabs_generate_stylesheet('garland', $info, $palette);
}
}
}
Functions
Name | Description |
---|---|
vertical_tabs_enable | Implement hook_enable(). |
vertical_tabs_install | Implement hook_install(). |
vertical_tabs_install_color_generate | Initialize the color-enabled stylesheet if using Garland. |
vertical_tabs_uninstall | Implement hook_uninstall(). |
vertical_tabs_update_6100 | Reduce the module weight and remove the form settings variable. |
vertical_tabs_update_6101 | Color-enable the module if using Garland. |
vertical_tabs_update_6102 | Regenerate the stylesheets if using Garland to accomidate for CSS changes. |
vertical_tabs_update_6103 | Remove any variables of deleted node types. |
vertical_tabs_update_6104 | Delete the node type fieldset configurations. |