Index: modules/node/content_types.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/content_types.inc,v retrieving revision 1.50 diff -u -p -r1.50 content_types.inc --- modules/node/content_types.inc 27 Jan 2008 18:03:05 -0000 1.50 +++ modules/node/content_types.inc 27 Jan 2008 20:36:47 -0000 @@ -46,7 +46,54 @@ function node_overview_types() { } /** + * Helper function to fix up the active trail by inseting a link to admin/content/types. + * + * The link is insterted prior to admin/content/node-type/$type->type, if this + * exists in the active trail. + */ +function _node_type_fix_trail($type) { + if (!isset($type->type)) { + return; + } + // Do our usual, fragile conversion of _ to - for paths from types. + $type_path = 'admin/content/node-type/'. str_replace('_', '-', $type->type); + $trail = menu_get_active_trail(); + // Find the offset - the position of admin/content/node-type/$type->type + $offset = 0; + foreach ($trail as $key => $link) { + if ($link['href'] == $type_path) { + break; + } + $offset++; + } + if ($offset < count($trail) && isset($trail[$offset - 1]) && $trail[$offset - 1]['href'] != 'admin/content/types') { + $mlid = db_result(db_query("SELECT mlid FROM {menu_links} WHERE menu_name = '%s' AND link_path = '%s' ORDER BY mlid", menu_get_active_menu_name(), 'admin/content/types')); + if ($mlid) { + $link = menu_link_load($mlid); + $end = array_slice($trail, $offset); + array_unshift($end, $link); + array_splice($trail, $offset, count($trail), $end); + menu_set_active_trail($trail); + } + } +} + +/** + * Page callback for the node type editing form. + * + * Fixes up the active trail to make the breadcrumb more useful. + */ +function node_type_edit_page($type) { + _node_type_fix_trail($type); + return drupal_get_form('node_type_form', $type); +} + +/** * Generates the node type editing form. + * + * @ingroup forms + * @see node_type_form_validate() + * @see node_type_form_submit() */ function node_type_form(&$form_state, $type = NULL) { if (!isset($type->type)) { @@ -215,6 +262,8 @@ function node_type_form(&$form_state, $t /** * Implementation of hook_form_validate(). + * + * @see node_type_form() */ function node_type_form_validate($form, &$form_state) { $type = new stdClass(); @@ -249,6 +298,8 @@ function node_type_form_validate($form, /** * Implementation of hook_form_submit(). + * + * @see node_type_form() */ function node_type_form_submit($form, &$form_state) { $op = isset($form_state['values']['op']) ? $form_state['values']['op'] : ''; Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.943 diff -u -p -r1.943 node.module --- modules/node/node.module 27 Jan 2008 18:13:04 -0000 1.943 +++ modules/node/node.module 27 Jan 2008 20:36:48 -0000 @@ -1481,8 +1481,8 @@ function node_menu() { ); $items['admin/content/node-type/'. $type_url_str] = array( 'title' => $type->name, - 'page callback' => 'drupal_get_form', - 'page arguments' => array('node_type_form', $type), + 'page callback' => 'node_type_edit_page', + 'page arguments' => array($type), 'file' => 'content_types.inc', 'type' => MENU_CALLBACK, );