function _dhtml_menu_replace in DHTML Menu 5
Replaces the navigation block in all themes by assigning its values to this module's block, then disabling the normal block.
1 string reference to '_dhtml_menu_replace'
- dhtml_menu_menu in ./
dhtml_menu.module - Implementation of hook_menu().
File
- ./
dhtml_menu.module, line 103 - DHTML menus
Code
function _dhtml_menu_replace() {
// Ensure that the block table is up to date.
_block_rehash();
// Get the navigation blocks of all themes
$res = db_query("SELECT status, weight, region, visibility, pages, title, theme\n FROM {blocks} WHERE module = 'user' AND delta = 1");
while ($row = db_fetch_array($res)) {
$navigation_settings[$row['theme']] = $row;
}
// Enable the equivalent DHTML menu and
// disable the original one
foreach ($navigation_settings as $theme => $row) {
db_query("UPDATE {blocks} SET status = %d, weight = %d, region = '%s',\n visibility = %d, pages = %d, title = '%s'\n WHERE module = 'dhtml_menu'\n AND delta = 1 AND theme = '%s'", $row);
// relies on $mid of 'Navigation' menu being 1, see dhtml_menu_block('list')
db_query("UPDATE {blocks} SET status = 0, region = ''\n WHERE module = 'user' AND delta = 1 AND theme = '%s'", $theme);
}
drupal_set_message(t('Your navigation block has been replaced with its DHTML equivalent in all currently enabled themes.'), 'status');
// go to block administration
drupal_goto('admin/build/block');
// Its generally not necessary, but for safety, return.
return;
}