og_menu_single.install in OG Menu Single 7
Install hooks for OG menu single.
File
og_menu_single.installView source
<?php
/**
* @file
* Install hooks for OG menu single.
*/
/**
* Implements hook_install().
*/
function og_menu_single_install() {
module_load_include('module', 'og_menu_single');
$t = get_t();
$menu = array(
'menu_name' => OG_MENU_SINGLE_MENU_NAME,
'title' => $t('OG menu'),
'description' => $t('Contains all the links for organic groups and their menus'),
);
menu_save($menu);
}
/**
* Implements hook_uninstall().
*/
function og_menu_single_uninstall() {
if ($menu = menu_load(OG_MENU_SINGLE_MENU_NAME)) {
menu_delete($menu);
}
$vars = array(
'og_menu_single_group_content__node_',
'og_menu_single_group__node_',
);
foreach (node_type_get_names() as $type => $name) {
foreach ($vars as $var) {
variable_del($var . '_' . $type);
}
}
}
/**
* Fix variable names.
*/
function og_menu_single_update_7102() {
$vars = array(
'og_menu_single_group_content__node_',
'og_menu_single_group__node_',
);
foreach (node_type_get_names() as $type => $name) {
foreach ($vars as $var) {
$old_name = $var . '_' . $type . '_' . $type;
$new_name = $var . '_' . $type;
if (($value = variable_get($old_name, 'not-set')) !== 'not-set') {
variable_set($new_name, $value);
variable_del($old_name);
drupal_set_message(t('Renamed variable @old_name to @new_name, if you were using it as part of strongarm(features) export or install operation, please update.', array(
'@old_name' => $old_name,
'@new_name' => $new_name,
)), 'warning');
}
}
}
}
Functions
Name | Description |
---|---|
og_menu_single_install | Implements hook_install(). |
og_menu_single_uninstall | Implements hook_uninstall(). |
og_menu_single_update_7102 | Fix variable names. |