termcase.install in Termcase 7
Same filename and directory in other branches
Install, update and uninstall functions for the Termcase module.
File
termcase.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the Termcase module.
*/
/**
* Implements hook_install().
*/
function termcase_install() {
module_load_include('module', 'termcase');
$vocabularies = taxonomy_get_vocabularies();
foreach ($vocabularies as $vid => $vocabulary) {
_termcase_vocabulary_termcase($vocabulary->machine_name, TERMCASE_NONE);
}
$t = get_t();
drupal_set_message($t('You can now define Termcase settings per vocabulary on the <a href="@vocabularies">taxonomy settings</a> page.', array(
'@vocabularies' => url('admin/structure/taxonomy'),
)));
}
/**
* Implements hook_uninstall().
*/
function termcase_uninstall() {
module_load_include('module', 'termcase');
$vocabularies = taxonomy_get_vocabularies();
foreach ($vocabularies as $vid => $vocabulary) {
_termcase_vocabulary_termcase_delete($vocabulary->machine_name);
}
}
/**
* Update the variables to use machine names.
*/
function termcase_update_7001() {
$vocabularies = taxonomy_get_vocabularies();
foreach ($vocabularies as $vid => $vocabulary) {
$vocabulary_name = $vocabulary->machine_name;
if (variable_get('taxonomy_vocabulary_' . $vocabulary_name . '_termcase', NULL) == NULL) {
variable_set('taxonomy_vocabulary_' . $vocabulary_name . '_termcase', variable_get('taxonomy_vocabulary' . $vid . '_termcase', NULL));
}
variable_del('taxonomy_vocabulary' . $vid . '_termcase');
}
}
Functions
Name | Description |
---|---|
termcase_install | Implements hook_install(). |
termcase_uninstall | Implements hook_uninstall(). |
termcase_update_7001 | Update the variables to use machine names. |