taxonomy_menu_block.install in Taxonomy menu block 7
Installation file for taxonomy_block.
File
taxonomy_menu_block.installView source
<?php
/**
* @file
* Installation file for taxonomy_block.
*/
/**
* Implements hook_uninstall().
*/
function taxonomy_menu_block_uninstall() {
// Delete menu block variables.
foreach (variable_get('taxonomy_menu_block_ids', array()) as $delta) {
variable_del("taxonomy_menu_block_{$delta}");
}
variable_del('taxonomy_menu_block_ids');
// Remove block configurations.
db_delete('block')
->condition('module', 'taxonomy_menu_block')
->execute();
db_delete('block_role')
->condition('module', 'taxonomy_menu_block')
->execute();
cache_clear_all();
}
/**
* Make old blocks compatible with newly added configuration options.
*/
function taxonomy_menu_block_update_7100() {
module_load_include('inc', 'taxonomy_menu_block', 'taxonomy_menu_block.admin');
// Cache clear
cache_clear_all('taxonomy_menu_block', 'cache', TRUE);
// Loop over all existing blocks and re-save them with the newly added options.
foreach (variable_get('taxonomy_menu_block_ids', array()) as $delta) {
$config = taxonomy_menu_block_get_config($delta);
if (!isset($config['nodes'])) {
$config['nodes'] = 0;
}
if (!isset($config['nodes_aggregation'])) {
$config['nodes_aggregation'] = 0;
}
if (!isset($config['hide_empty'])) {
$config['hide_empty'] = 0;
}
taxonomy_menu_block_save_block($delta, $config);
}
}
/**
* Make old blocks compatible with new node options.
*/
function taxonomy_menu_block_update_7101() {
module_load_include('inc', 'taxonomy_menu_block', 'taxonomy_menu_block.admin');
// Loop over all existing blocks and re-save them with the newly added options.
foreach (variable_get('taxonomy_menu_block_ids', array()) as $delta) {
$config = taxonomy_menu_block_get_config($delta);
if (!isset($config['ctype'])) {
$config['ctype'] = array();
}
taxonomy_menu_block_save_block($delta, $config);
}
}
Functions
Name![]() |
Description |
---|---|
taxonomy_menu_block_uninstall | Implements hook_uninstall(). |
taxonomy_menu_block_update_7100 | Make old blocks compatible with newly added configuration options. |
taxonomy_menu_block_update_7101 | Make old blocks compatible with new node options. |