...
 
Commits (35)
Menu Block 7.x-2.x-dev, xxxx-xx-xx (development release)
----------------------------------
- #1420180 by jweowu: Assign the panel panes for menu block blocks to the "Menus" category
- #1937038: Use $max_depth parameter of menu_tree_all_data() and menu_tree_page_data()
- #907292: Add API to obtain raw menu data (not the render element)
- #1327472 by tim.plunkett, pjcdawkins and giginos: Child menu items don't appear when current page is front page
- #1698992: hook_uninstall assumes block module dependency
- #1594684 by pfournier: Menu block export ids may be too long, plus unquoted string
- #1812824 by gabriel.achille: Incompatibility with modules like menu_position
- #1203646 by jweowu: Pane generates illegal choice error when editing
- #1909366 by lund.mikkel: Menu block names get translated twice
- #1910420 by simongeorges: Remove useless files[] directive from .info files
- #1204064 by MrHaroldA, pjcdawkins and BartK: Fix undefined index notices in menu_tree_add_active_path()
- #810362: Make Menu Block require 'administer menus' permission
- #1524674 by Crell: Use of $_GET['q'] ignores menu_position module
- #1688168 by tim.plunkett: Undefined index errors when using CTools content type and '_active' menu
- #1701702: Disabled menu items still trigger "the menu selected by the page"
Menu Block 7.x-2.3, 2012-02-04
------------------------------
- #1105372 by mikl, fabsor and JohnAlbin: Add menu tree ctools content type to D7
- #1425342 by JohnAlbin and Dave Reid: Menu block fails with Drupal core 7.12; remove work-around for core bug #942782.
- #1243978 by Dave Reid: Fixed menu_block_export_menu() items were not translatable since they were not located in menu_block_export.module.
- #1243978 by Dave Reid: Fixed menu_block_menu() items were not translatable since they were not located in menu_block.module.
- by Dave Reid: Moved menu_block_menu_alter() to menu_block.menu so that it doesn't cause a module hook cache miss.
- #1155052 by Dave Reid: Fixed errors if block module is not enabled.
- #1162038 by Dave Reid: Fixed 'Add menu block' local action only appears on default theme.
- #1114722 by dropcube: Fixed i18n menu support
- #1154122 by Dave Reid: Moved block module hook implementations to menu_block.module to prevent problems with hook implementation caching.
- #1078806 by Dave Reid: Fixed string untranslated warning from coder.
- #1139530 by Dave Reid: Add a base form ID of block_add_block_form to menu_block_add_block_form so other modules can properly and easily alter it.
- #1139522 by Dave Reid: Fixed fatal error with current page menu trees.
Menu Block 7.x-2.2, 2011-03-09
------------------------------
- #1086376: Custom menu fix doesn't work for new installations
Menu Block 7.x-2.1, 2011-02-06
------------------------------
- #1051988: Fix wrong path in menu_block_help()
- #1050766: Improve usability of "Parent item" UI
- #1050040 by AgentRickard: Remove performance-killing variable_set() calls on non-admin pages
Menu Block 7.x-2.0, 2011-01-11
------------------------------
- #1022478: Add "Edit book outline" contextual link for book menu blocks
- #1022428: Contextual links for all menu blocks disappear if book menu_block used
- #1017142: except for one menu, all other menus (including books) never receive an active trail
- #1017122 by becw, mfer and JohnAlbin: Core bug work-around: add active trail to custom menus
- Always show core menu blocks if they are in a region
- #993998 by tgf: Core menu suppression broken
- #993998 by jackinloadup: Delete links misplaced on menu list form
- #958166 by Simon Georges and JohnAlbin: secondary-menu removed from core; replace with user-menu
- #825132: Performance problem on sites with many books
- #945714 by pedrochristopher: theme override misidentified in README
- #593126: hook_get_menus() causes conflicts with Menu Access, og_menu, etc
- #825132: Add hook_menu_block_get_sort_menus() for improved performance and UX of book integration
- #957362 by blixxxa: Add Swedish translation
- Fix theme hook suggestions for non-numeric block deltas
Menu Block 7.x-2.0-beta4, 2010-09-29
------------------------------------
- #891690: Never accept a fix not in patch form. And if you do, test it!
Menu Block 7.x-2.0-beta3, 2010-09-29
------------------------------------
- #891698 by Chris Gillis: Incorrect link to configuration page
- #891690 by Chris Gillis: Undefined function db_fetch_array
- Updated menu_block_get_title() to return a renderable array
- Add #bid context to menu_link theme hook
Menu Block 7.x-2.0-beta2, 2010-04-16
------------------------------------
- Add ability to suppress core's standard menu blocks on block admin page
- #693302: Add simple bulk export module
- Fixed import of exportable menu_blocks
- Fixed bug causing missing "delete" link for menu blocks
- Fixed configure link on modules page
Menu Block 7.x-2.0-beta1, 2010-03-26
------------------------------------
- #693302: Add API for exportable menu_blocks
- #749838: Port to Drupal 7
Menu Block 6.x-2.3, 2010-03-24
------------------------------
- #739282: Users with "administer menu" privileges can exploit XSS vulnerability
- #343061 by sun and JohnAlbin: CSS styling breaks form layout
- #345552 by Dmitriy.trt: Inconsistent display of starting level set to children
of active item
- #474784: Menu title as link is incorrectly always marked as in active trail
- #540842 by JohnAlbin and agentrickard: Add option to use current page's
selected menu
- #580348: Add administrative title to config form to help organize blocks
- #350029: Add theme hook suggestions for all theme function calls
- #741284 by JohnAlbin, sdboyer, and hefox: Add "menu tree" content types to
Chaos Tools/Panels.
- #741284 by JohnAlbin and hefox: Add menu_block_get_config() and
menu_block_configure_form() to make the configuration form reusable by
separating it from the Block API functions.
- #553842 by apodran and JohnAlbin: split() is deprecated in PHP 5.3
- #398888: "exanded" elements of a menu-item-rooted tree aren't expanded
- #703968 by hefox and JohnAlbin: Add menu_tree_build() to allow reuse of tree
building code outside of blocks
- Refactored API for menu_block_get_title() and menu_block_set_title()
- Added HOOK_menu_block_tree_alter() to allow direct tree manipulation
- by Denes Szabo and Zoltan Balogh: Added Hungarian translation
- Make default menu be "Primary links" instead of "Navigation"
- #378206 by sbordage: Added French translation
- #345419: Add option for menu title as link
- #347805: Add delta to variables and classes in menu-block-wrapper.tpl
Menu Block 6.x-2.2, 2008-12-16
------------------------------
- #342498: Give unique class to depth-limited leaves that have children
- #341436: Depth-limited leaves that have children get "collapsed" icon
- #341345: WSOD on "Add menu block" page with some PHP versions
Menu Block 6.x-2.1, 2008-12-01
------------------------------
- #300086: Add option to make starting level follow active menu item
- #340868: Clean up display of block configuration options
- #300094: Add option to sort active trail to top of menu tree
- #328238 by gorbeia: Add support for i18n menu translation
- #331934: Add option to select parent item of menu tree
- #330978: Add hook_get_menus() and implement Book module integration
- #331935: Replace admin/by-module hack with README.txt
- #332974: Collapsed menu items get "leaf" class when using "depth" option
- #333988: Create template for menu-block-wrapper
- #331933 by sun: Help links are displayed if Help module is disabled
- #338263: Migration from 5.x-1.x to 6.x-2.x is broken
- #305267: Menu blocks incorrectly cached per role
Menu Block 6.x-2.0, 2008-08-25
------------------------------
- Added extensive documentation help text
- Added extended classes to menu trees
- Menu block's administrative interface now matches the block module's standard
add, configure, and delete interface
- #266230: Port Menu block to D6
Menu Block 5.x-2.0, 2008-11-24
------------------------------
- #304675: Port 6.x admin interface to 5.x
- Added missing dependency on menu module
Menu Block 5.x-1.0, 2008-08-05
------------------------------
- Simplified block configuration
Menu Block 5.x-0.9, 2008-08-05
------------------------------
- #266223: Add option to limit the depth of the tree to an arbitrary level
- Added block config to specify whether to expand all children
- Added settings to enable specific menu blocks
This diff is collapsed.
......@@ -92,6 +92,19 @@ function hook_menu_block_get_sort_menus() {
return $menus;
}
/**
* Respond to menu block deletion.
*
* @param array $config
* The menu block configuration.
*/
function hook_menu_block_delete(array $config) {
db_delete('block_data')
->condition('module', 'menu_block')
->condition('delta', $config['delta'])
->execute();
}
/**
* @} End of "addtogroup hooks".
*/
......@@ -18,7 +18,7 @@ function _menu_tree_prune_active_tree(&$tree, $level) {
do {
$found_active_trail = FALSE;
// Examine each element at this level for the active trail.
foreach ($tree AS $key => &$value) {
foreach ($tree as $key => &$value) {
if ($tree[$key]['link']['in_active_trail']) {
$found_active_trail = TRUE;
// If the active trail item has children, examine them.
......@@ -26,7 +26,7 @@ function _menu_tree_prune_active_tree(&$tree, $level) {
// If we are pruning to the active menu item's level, check if this
// is the active menu item by checking its children.
if ($level == 'active') {
foreach ($tree[$key]['below'] AS $child_key => &$value) {
foreach ($tree[$key]['below'] as $child_key => &$value) {
if ($tree[$key]['below'][$child_key]['link']['in_active_trail']) {
// Get the title for the pruned tree.
menu_block_set_title($tree[$key]['link']);
......
......@@ -9,31 +9,25 @@
*/
function menu_block_uninstall() {
// Delete menu block variables.
foreach (variable_get('menu_block_ids', array()) AS $delta) {
variable_del("menu_block_{$delta}_title_link");
variable_del("menu_block_{$delta}_admin_title");
variable_del("menu_block_{$delta}_parent");
variable_del("menu_block_{$delta}_level");
variable_del("menu_block_{$delta}_follow");
variable_del("menu_block_{$delta}_depth");
variable_del("menu_block_{$delta}_expanded");
variable_del("menu_block_{$delta}_sort");
drupal_load('module', 'menu_block');
$variable_keys = array_keys(menu_block_default_config());
foreach (variable_get('menu_block_ids', array()) as $delta) {
foreach ($variable_keys as $key) {
variable_del("menu_block_{$delta}_{$key}");
}
}
variable_del('menu_block_ids');
variable_del('menu_block_suppress_core');
variable_del('menu_block_menu_order');
// Remove block configurations.
if (module_exists('block')) {
db_delete('block')
->condition('module', 'menu_block')
->execute();
db_delete('block_role')
->condition('module', 'menu_block')
->execute();
foreach (array('block', 'block_node_type', 'block_role') as $table) {
if (db_table_exists($table)) {
db_delete($table)
->condition('module', 'menu_block')
->execute();
}
}
cache_clear_all();
}
/**
......@@ -43,13 +37,6 @@ function menu_block_enable() {
drupal_set_message(t('To use menu blocks, find the "Add menu block" link on the <a href="@url">administer blocks page</a>.', array('@url' => url('admin/structure/block'))));
}
/**
* Implements hook_install().
*/
function menu_block_install() {
// No-op.
}
/**
* Converts pre-5.x-1.0 block names to the new format.
*/
......@@ -58,7 +45,7 @@ function menu_block_update_5100() {
$enabled_blocks = array();
// Find the old enabled blocks.
foreach (variable_get('menu_block_enabled_blocks', array()) AS $old_delta => $enabled) {
foreach (variable_get('menu_block_enabled_blocks', array()) as $old_delta => $enabled) {
list($mid, $level) = explode('-', $old_delta);
if ($enabled) {
$enabled_blocks[++$delta] = TRUE;
......@@ -81,7 +68,7 @@ function menu_block_update_5100() {
*/
function menu_block_update_5200() {
$block_ids = array();
foreach (variable_get('menu_block_enabled_blocks', array()) AS $delta => $enabled) {
foreach (variable_get('menu_block_enabled_blocks', array()) as $delta => $enabled) {
if ($enabled) {
$block_ids[] = $delta; // Build new $menu_block_ids.
// Convert $menu_block_DELTA_mid to $menu_block_DELTA_menu_name.
......@@ -122,7 +109,7 @@ function menu_block_update_5200() {
*/
function menu_block_update_6200() {
$menus = menu_get_menus();
foreach (variable_get('menu_block_ids', array()) AS $delta) {
foreach (variable_get('menu_block_ids', array()) as $delta) {
// Drupal 6 uses the menu title to create the new menu_name.
$menu_name = preg_replace('/[^a-zA-Z0-9]/', '-', strtolower(variable_get("menu_block_{$delta}_title", '')));
// If we can't find the new menu_name, default to the navigation menu.
......@@ -140,7 +127,7 @@ function menu_block_update_6200() {
*/
function menu_block_update_6201() {
$menus = menu_get_menus();
foreach (variable_get('menu_block_ids', array()) AS $delta) {
foreach (variable_get('menu_block_ids', array()) as $delta) {
variable_set("menu_block_{$delta}_parent", variable_get("menu_block_{$delta}_menu_name", 'navigation') . ':0');
variable_del("menu_block_{$delta}_menu_name");
}
......@@ -151,7 +138,7 @@ function menu_block_update_6201() {
* Converts to Drupal 7 menu names.
*/
function menu_block_update_7200() {
foreach (variable_get('menu_block_ids', array()) AS $delta) {
foreach (variable_get('menu_block_ids', array()) as $delta) {
$menu_name = '';
list($old_menu_name, $parent_mlid) = explode(':', variable_get("menu_block_{$delta}_parent", ' : '));
switch ($old_menu_name) {
......@@ -200,3 +187,10 @@ function menu_block_fix_custom_menus() {
function menu_block_update_7202() {
menu_block_fix_custom_menus();
}
/**
* Trigger a menu rebuild.
*/
function menu_block_update_7203() {
// Nothing needed here.
}
This diff is collapsed.
......@@ -19,7 +19,7 @@ function _menu_tree_sort_active_path(&$tree) {
// Traverse the tree along the active trail.
do {
$next_level = $sort = $first_key = FALSE;
foreach ($current_level AS $key => &$value) {
foreach ($current_level as $key => &$value) {
// Save the first key for later use.
if (!$first_key) {
$first_key = $key;
......
......@@ -56,7 +56,7 @@ function menu_block_export_form_submit(&$form, &$form_state) {
$output = '';
$module = check_plain($form_state['values']['name']);
foreach (variable_get('menu_block_ids', array()) AS $delta) {
foreach (variable_get('menu_block_ids', array()) as $delta) {
$config = menu_block_get_config($delta);
// Use the constant instead of the constant's value.
if ($config['menu_name'] == MENU_TREE__CURRENT_PAGE_MENU) {
......@@ -75,8 +75,7 @@ function menu_block_export_form_submit(&$form, &$form_state) {
$output .= <<<END_OF_CONFIG
'$id' => array(
'menu_name' => {$config['menu_name']},
'parent_mlid' => {$config['parent_mlid']},
'parent' => {$config['parent']},
'title_link' => {$config['title_link']},
'admin_title' => '{$config['admin_title']}',
'level' => {$config['level']},
......
......@@ -17,6 +17,9 @@ $plugin = array(
'title' => t('Menu tree'),
);
// Load the standard config form.
module_load_include('inc', 'menu_block', 'menu_block.admin');
/**
* Supplies a list of menu tree content sub-types.
*/
......@@ -33,7 +36,6 @@ function menu_block_menu_tree_content_type_content_types() {
'js' => array(drupal_get_path('module', 'menu_block') . '/menu-block.js'),
'css' => array(drupal_get_path('module', 'menu_block') . '/menu-block-admin.css'),
);
unset($common_plugin['defaults']['delta']);
$menus = menu_block_get_all_menus();
$items = array();
......@@ -41,6 +43,7 @@ function menu_block_menu_tree_content_type_content_types() {
$items[$menu_name] = $common_plugin;
$items[$menu_name]['title'] = t('%menu menu tree', array('%menu' => $title));
$items[$menu_name]['defaults']['menu_name'] = $menu_name;
$items[$menu_name]['defaults']['parent'] = $menu_name . ':0';
$items[$menu_name]['menu_title'] = $title;
// Custom icons/titles for some menus.
switch ($menu_name) {
......@@ -86,7 +89,10 @@ function menu_block_menu_tree_content_type_render($subtype, $conf, $args, $conte
$tree = menu_tree_build($conf);
$block = new stdClass();
$block->subtype = $conf['menu_name'];
$block->module = 'menu_block';
// Add contextual links.
menu_block_block_view_alter($tree, $block);
$block->subtype = isset($tree['content']['#config']['menu_name']) ? $tree['content']['#config']['menu_name'] : $conf['menu_name'];
$block->title = $tree['subject'];
$block->title_array = $tree['subject_array'];
$block->content = $tree['content'];
......@@ -100,8 +106,6 @@ function menu_block_menu_tree_content_type_render($subtype, $conf, $args, $conte
function menu_block_menu_tree_content_type_edit_form($form, &$form_state) {
$conf = $form_state['conf'];
// Load the standard config form.
module_load_include('inc', 'menu_block', 'menu_block.admin');
// Create a pseudo form state.
$sub_form_state = array('values' => $conf);
$form += menu_block_configure_form($form, $sub_form_state);
......@@ -129,6 +133,9 @@ function menu_block_menu_tree_content_type_edit_form_submit(&$form, &$form_state
foreach (array_keys($form_state['subtype']['defaults']) as $key) {
$form_state['conf'][$key] = $form_state['values'][$key];
}
if (!empty($form_state['values']['parent'])) {
list($form_state['conf']['menu_name'], $form_state['conf']['parent_mlid']) = explode(':', $form_state['values']['parent']);
}
}
/**
......@@ -140,7 +147,6 @@ function menu_block_menu_tree_content_type_admin_title($subtype, $conf, $context
}
else {
// Build the menu tree.
module_load_include('inc', 'menu_block', 'menu_block.admin');
$output = _menu_block_format_title($conf);
}
return $output;
......