nice_menus.install in Nice Menus 7.3
Same filename and directory in other branches
Update functions for Nice menus.
File
nice_menus.installView source
<?php
/**
* @file
* Update functions for Nice menus.
*/
/**
* Implements hook_uninstall().
*/
function nice_menus_uninstall() {
// Remove all the configuration variables added by the module.
db_delete('variable')
->condition('name', 'nice_menus_%', 'LIKE')
->execute();
// Remove all the block configurations of the module.
if (module_exists('block')) {
db_delete('block')
->condition('module', 'nice_menus')
->execute();
db_delete('block_node_type')
->condition('module', 'nice_menus')
->execute();
db_delete('block_role')
->condition('module', 'nice_menus')
->execute();
}
cache_clear_all();
}
/**
* Implements hook_update_N().
*/
function nice_menus_update_6000() {
// Existing blocks need to be set to no caching.
$ret = array();
/*
* TODO update_sql has been removed. Use the database API for any
* schema or data changes.
* update_sql("UPDATE {block} SET cache = -1 WHERE module = 'nice_menus'").
*/
$ret[] = array();
/*
* hook_update_N() no longer returns a $ret array. Instead, return
* nothing or a translated string indicating the update ran successfully.
* See http://drupal.org/node/224333#update_sql.
*/
return t('TODO Add a descriptive string here to show in the UI.');
}
/**
* Implements hook_update_N().
*/
function nice_menus_update_6001() {
// Switch the JS toggle variable name.
$old_setting = variable_get('nice_menus_ie', 1);
variable_set('nice_menus_js', $old_setting);
variable_del('nice_menus_ie');
// hook_update_N() no longer returns a $ret array. Instead, return
// nothing or a translated string indicating the update ran successfully.
// See http://drupal.org/node/224333#update_sql.
return t('TODO Add a descriptive string here to show in the UI.');
}
/**
* Implements hook_update_N().
*
* Update the menu selection variables to match the new format that allows
* selection of the exact menu item to start the display from.
*/
function nice_menus_update_6002() {
for ($delta = 1; $delta <= variable_get('nice_menus_number', '2'); $delta++) {
$menu = variable_get('nice_menus_menu_' . $delta, 'navigation');
// If no menu item is selected.
if (strpos($menu, ':') === FALSE) {
variable_set('nice_menus_menu_' . $delta, $menu . ':0');
}
}
}
Functions
Name | Description |
---|---|
nice_menus_uninstall | Implements hook_uninstall(). |
nice_menus_update_6000 | Implements hook_update_N(). |
nice_menus_update_6001 | Implements hook_update_N(). |
nice_menus_update_6002 | Implements hook_update_N(). |