Index: admin_menu.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/admin_menu/admin_menu.inc,v retrieving revision 1.80 diff -u -p -r1.80 admin_menu.inc --- admin_menu.inc 6 Jan 2011 23:47:41 -0000 1.80 +++ admin_menu.inc 7 Jan 2011 03:36:22 -0000 @@ -27,7 +27,13 @@ function admin_menu_tree($menu_name) { // system stores paths using anonymous placeholders. $replacements = array_fill_keys(array_keys($data['arguments'][0]), '%'); $data['parent'] = strtr($data['parent'], $replacements); - $new_map[strtr($path, $replacements)] = $data; + $parent_path = strtr($path, $replacements); + if (!isset($new_map[$parent_path])) { + $new_map[$parent_path] = $data; + } + else { + $new_map[$parent_path] = drupal_array_merge_deep($new_map[$parent_path], $data); + } // Collect paths to hide. if (isset($data['hide'])) { @@ -36,12 +42,15 @@ function admin_menu_tree($menu_name) { } $expand_map = $new_map; unset($new_map); + dsm($expand_map); // Retrieve dynamic menu link tree for the expansion mappings. $tree_dynamic = admin_menu_tree_dynamic($expand_map); + dsm($tree_dynamic); // Merge local tasks with static menu tree. $tree = menu_tree_all_data($menu_name); +# dsm($tree); admin_menu_merge_tree($tree, $tree_dynamic, array(), $hidden); return $tree; @@ -165,9 +174,13 @@ function admin_menu_merge_tree(array &$t if (!isset($tree_dynamic[$path])) { continue; } + dsm($path); // Add expanded dynamic items. + dsm($tree_dynamic[$path]); foreach ($tree_dynamic[$path] as $link) { + dsm($link['path']); + $current_expand_map = array(); // If the dynamic item has custom placeholder expansion parameters set, // use them, otherwise keep current. if (isset($link['expand_map'])) { @@ -179,7 +192,6 @@ function admin_menu_merge_tree(array &$t else { // Otherwise we need to filter out elements that differ from the // current set, i.e. that are not in the same path. - $current_expand_map = array(); foreach ($expand_map as $arguments) { foreach ($arguments as $placeholder => $value) { foreach ($link['expand_map'] as $new_arguments) { @@ -197,6 +209,7 @@ function admin_menu_merge_tree(array &$t else { $current_expand_map = $expand_map; } + dsm($current_expand_map); // Skip dynamic items without expansion parameters. if (empty($current_expand_map)) { @@ -220,6 +233,9 @@ function admin_menu_merge_tree(array &$t $path_dynamic = implode('/', $path_args); // Create new menu items using expansion arguments. +// dsm($path_args); + dsm($path_dynamic); +// dsm($current_expand_map); foreach ($current_expand_map as $arguments) { // Create the cartesian product for all arguments and create new // menu items for each generated combination thereof. @@ -228,6 +244,7 @@ function admin_menu_merge_tree(array &$t // Skip this item, if any placeholder could not be replaced. // Faster than trying to invoke _menu_translate(). if (strpos($newpath, '%') !== FALSE) { + dsm($newpath); continue; } $map = explode('/', $newpath); @@ -241,6 +258,7 @@ function admin_menu_merge_tree(array &$t foreach ($replacements as $placeholder => $value) { $new_expand_map[$placeholder] = array($value); } + dsm($new_expand_map); admin_menu_merge_tree($item, $tree_dynamic, array($new_expand_map), $hidden); $tree[$key]['below'] += $item; } Index: admin_menu.map.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/admin_menu/admin_menu.map.inc,v retrieving revision 1.5 diff -u -p -r1.5 admin_menu.map.inc --- admin_menu.map.inc 6 Jan 2011 23:27:40 -0000 1.5 +++ admin_menu.map.inc 7 Jan 2011 03:30:17 -0000 @@ -12,7 +12,7 @@ /** * Implements hook_admin_menu_map() on behalf of Filter module. */ -function filter_admin_menu_map() { +function xfilter_admin_menu_map() { if (!user_access('administer filters')) { return; } @@ -29,7 +29,7 @@ function filter_admin_menu_map() { /** * Implements hook_admin_menu_map() on behalf of Menu module. */ -function menu_admin_menu_map() { +function xmenu_admin_menu_map() { if (!user_access('administer menu')) { return; } @@ -46,7 +46,7 @@ function menu_admin_menu_map() { /** * Implements hook_admin_menu_map() on behalf of Node module. */ -function node_admin_menu_map() { +function xnode_admin_menu_map() { if (!user_access('administer content types')) { return; } @@ -61,6 +61,22 @@ function node_admin_menu_map() { } /** + * Implements hook_admin_menu_map() on behalf of Comment module. + */ +function comment_admin_menu_map() { + if (!user_access('administer content types')) { + return; + } + $map['admin/structure/types/manage/%comment_node_type'] = array( + 'parent' => 'admin/structure/types', + 'arguments' => array( + array('%comment_node_type' => array_keys(node_type_get_types())), + ), + ); + return $map; +} + +/** * Implements hook_admin_menu_map() on behalf of Field UI module. */ function field_ui_admin_menu_map() { @@ -68,6 +84,8 @@ function field_ui_admin_menu_map() { foreach (entity_get_info() as $obj_type => $info) { foreach ($info['bundles'] as $bundle_name => $bundle_info) { if (isset($bundle_info['admin'])) { + $path = $bundle_info['admin']['path']; + $parent_path = "$path/fields"; $arguments = array(); switch ($obj_type) { case 'comment': @@ -80,14 +98,17 @@ function field_ui_admin_menu_map() { if (drupal_substr($bundle_name, 0, 13) == 'comment_node_') { $bundle_name = drupal_substr($bundle_name, 13); } - // @todo Doesn't work yet. Why? +// $parent_path = explode('/', $bundle_info['admin']['path']); +// array_pop($parent_path); +// $parent_path[] = 'fields'; +// $parent_path = implode('/', $parent_path); $arguments = array( '%comment_node_type' => array($bundle_name), '%field_ui_menu' => $fields, ); break; - case 'node': + case 'xnode': $fields = array(); foreach (field_info_instances($obj_type, $bundle_name) as $field) { $fields[] = $field['field_name']; @@ -98,7 +119,7 @@ function field_ui_admin_menu_map() { ); break; - case 'taxonomy_term': + case 'xtaxonomy_term': $fields = array(); foreach (field_info_instances($obj_type, $bundle_name) as $field) { $fields[] = $field['field_name']; @@ -110,15 +131,14 @@ function field_ui_admin_menu_map() { ); break; - case 'user': + case 'xuser': $arguments = array( '%field_ui_menu' => array_keys(field_info_fields('user')), ); break; } if (!empty($arguments)) { - $path = $bundle_info['admin']['path']; - $map["$path/fields/%field_ui_menu"]['parent'] = "$path/fields"; + $map["$path/fields/%field_ui_menu"]['parent'] = $parent_path; $map["$path/fields/%field_ui_menu"]['arguments'][] = $arguments; } } @@ -130,7 +150,7 @@ function field_ui_admin_menu_map() { /** * Implements hook_admin_menu_map() on behalf of Taxonomy module. */ -function taxonomy_admin_menu_map() { +function xtaxonomy_admin_menu_map() { if (!user_access('administer taxonomy')) { return; } @@ -147,7 +167,7 @@ function taxonomy_admin_menu_map() { /** * Implements hook_admin_menu_map() on behalf of Views UI module. */ -function views_ui_admin_menu_map() { +function xviews_ui_admin_menu_map() { if (!user_access('administer views')) { return; }