diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-09-28 22:14:31 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-09-28 22:14:31 +0000 |
commit | 101d520929bb0e718d5a784d25bb1c5629e59269 (patch) | |
tree | 75538396934e9b7dc46f981f4af09d75e501a6a5 /modules/menu | |
parent | 65bb91c989b67952d77de8a1e573e857bac015da (diff) | |
download | brdo-101d520929bb0e718d5a784d25bb1c5629e59269.tar.gz brdo-101d520929bb0e718d5a784d25bb1c5629e59269.tar.bz2 |
- Patch #508570 by quicksketch, sun | pwolanin, bec: restore URL consistency for node types and menus.
Diffstat (limited to 'modules/menu')
-rw-r--r-- | modules/menu/menu.admin.inc | 26 | ||||
-rw-r--r-- | modules/menu/menu.module | 24 | ||||
-rw-r--r-- | modules/menu/menu.test | 14 |
3 files changed, 32 insertions, 32 deletions
diff --git a/modules/menu/menu.admin.inc b/modules/menu/menu.admin.inc index 42592fdd2..d0a7bc9d3 100644 --- a/modules/menu/menu.admin.inc +++ b/modules/menu/menu.admin.inc @@ -15,9 +15,9 @@ function menu_overview_page() { $rows = array(); foreach ($result as $menu) { $row = array(theme('menu_admin_overview', $menu['title'], $menu['menu_name'], $menu['description'])); - $row[] = array('data' => l(t('list links'), 'admin/structure/menu-customize/' . $menu['menu_name'])); - $row[] = array('data' => l(t('edit menu'), 'admin/structure/menu-customize/' . $menu['menu_name'] . '/edit')); - $row[] = array('data' => l(t('add link'), 'admin/structure/menu-customize/' . $menu['menu_name'] . '/add')); + $row[] = array('data' => l(t('list links'), 'admin/structure/menu/manage/' . $menu['menu_name'])); + $row[] = array('data' => l(t('edit menu'), 'admin/structure/menu/manage/' . $menu['menu_name'] . '/edit')); + $row[] = array('data' => l(t('add link'), 'admin/structure/menu/manage/' . $menu['menu_name'] . '/add')); $rows[] = $row; } @@ -69,7 +69,7 @@ function menu_overview_form($form, &$form_state, $menu) { ); } else { - $form['#empty_text'] = t('There are no menu links yet. <a href="@link">Add link</a>.', array('@link' => url('admin/structure/menu-customize/'. $form['#menu']['menu_name'] .'/add'))); + $form['#empty_text'] = t('There are no menu links yet. <a href="@link">Add link</a>.', array('@link' => url('admin/structure/menu/manage/'. $form['#menu']['menu_name'] .'/add'))); } return $form; } @@ -398,7 +398,7 @@ function menu_edit_item_submit($form, &$form_state) { if (!menu_link_save($item)) { drupal_set_message(t('There was an error saving the menu link.'), 'error'); } - $form_state['redirect'] = 'admin/structure/menu-customize/' . $item['menu_name']; + $form_state['redirect'] = 'admin/structure/menu/manage/' . $item['menu_name']; } /** @@ -478,7 +478,7 @@ function menu_edit_menu($form, &$form_state, $type, $menu = array()) { * Submit function for the 'Delete' button on the menu editing form. */ function menu_custom_delete_submit($form, &$form_state) { - $form_state['redirect'] = 'admin/structure/menu-customize/' . $form_state['values']['menu_name'] . '/delete'; + $form_state['redirect'] = 'admin/structure/menu/manage/' . $form_state['values']['menu_name'] . '/delete'; } /** @@ -505,7 +505,7 @@ function menu_delete_menu_confirm($form, &$form_state, $menu) { $caption .= '<p>' . format_plural($num_links, '<strong>Warning:</strong> There is currently 1 menu link in %title. It will be deleted (system-defined items will be reset).', '<strong>Warning:</strong> There are currently @count menu links in %title. They will be deleted (system-defined links will be reset).', array('%title' => $menu['title'])) . '</p>'; } $caption .= '<p>' . t('This action cannot be undone.') . '</p>'; - return confirm_form($form, t('Are you sure you want to delete the custom menu %title?', array('%title' => $menu['title'])), 'admin/structure/menu-customize/' . $menu['menu_name'], $caption, t('Delete')); + return confirm_form($form, t('Are you sure you want to delete the custom menu %title?', array('%title' => $menu['title'])), 'admin/structure/menu/manage/' . $menu['menu_name'], $caption, t('Delete')); } /** @@ -525,7 +525,7 @@ function menu_delete_menu_confirm_submit($form, &$form_state) { menu_reset_item($item); } // Delete all links to the overview page for this menu. - $result = db_query("SELECT mlid FROM {menu_links} ml WHERE ml.link_path = :link", array(':link' => 'admin/structure/menu-customize/' . $menu['menu_name']), array('fetch' => PDO::FETCH_ASSOC)); + $result = db_query("SELECT mlid FROM {menu_links} ml WHERE ml.link_path = :link", array(':link' => 'admin/structure/menu/manage/' . $menu['menu_name']), array('fetch' => PDO::FETCH_ASSOC)); foreach ($result as $m) { menu_link_delete($m['mlid']); } @@ -582,7 +582,7 @@ function menu_edit_menu_validate($form, &$form_state) { */ function menu_edit_menu_submit($form, &$form_state) { $menu = $form_state['values']; - $path = 'admin/structure/menu-customize/'; + $path = 'admin/structure/menu/manage/'; if ($form['#insert']) { // Add 'menu-' to the menu name to help avoid name-space conflicts. $menu['menu_name'] = 'menu-' . $menu['menu_name']; @@ -641,7 +641,7 @@ function menu_item_delete_page($item) { */ function menu_item_delete_form($form, &$form_state, $item) { $form['#item'] = $item; - return confirm_form($form, t('Are you sure you want to delete the custom menu link %item?', array('%item' => $item['link_title'])), 'admin/structure/menu-customize/' . $item['menu_name']); + return confirm_form($form, t('Are you sure you want to delete the custom menu link %item?', array('%item' => $item['link_title'])), 'admin/structure/menu/manage/' . $item['menu_name']); } /** @@ -653,7 +653,7 @@ function menu_item_delete_form_submit($form, &$form_state) { $t_args = array('%title' => $item['link_title']); drupal_set_message(t('The menu link %title has been deleted.', $t_args)); watchdog('menu', 'Deleted menu link %title.', $t_args, WATCHDOG_NOTICE); - $form_state['redirect'] = 'admin/structure/menu-customize/' . $item['menu_name']; + $form_state['redirect'] = 'admin/structure/menu/manage/' . $item['menu_name']; } /** @@ -661,7 +661,7 @@ function menu_item_delete_form_submit($form, &$form_state) { */ function menu_reset_item_confirm($form, &$form_state, $item) { $form['item'] = array('#type' => 'value', '#value' => $item); - return confirm_form($form, t('Are you sure you want to reset the link %item to its default values?', array('%item' => $item['link_title'])), 'admin/structure/menu-customize/' . $item['menu_name'], t('Any customizations will be lost. This action cannot be undone.'), t('Reset')); + return confirm_form($form, t('Are you sure you want to reset the link %item to its default values?', array('%item' => $item['link_title'])), 'admin/structure/menu/manage/' . $item['menu_name'], t('Any customizations will be lost. This action cannot be undone.'), t('Reset')); } /** @@ -671,7 +671,7 @@ function menu_reset_item_confirm_submit($form, &$form_state) { $item = $form_state['values']['item']; $new_item = menu_reset_item($item); drupal_set_message(t('The menu link was reset to its default settings.')); - $form_state['redirect'] = 'admin/structure/menu-customize/' . $new_item['menu_name']; + $form_state['redirect'] = 'admin/structure/menu/manage/' . $new_item['menu_name']; } /** diff --git a/modules/menu/menu.module b/modules/menu/menu.module index 7fc3ebe1f..72025fb01 100644 --- a/modules/menu/menu.module +++ b/modules/menu/menu.module @@ -78,41 +78,41 @@ function menu_menu() { 'weight' => 5, 'file' => 'menu.admin.inc', ); - $items['admin/structure/menu-customize/%menu'] = array( + $items['admin/structure/menu/manage/%menu'] = array( 'title' => 'Customize menu', 'page callback' => 'drupal_get_form', - 'page arguments' => array('menu_overview_form', 3), + 'page arguments' => array('menu_overview_form', 4), 'title callback' => 'menu_overview_title', - 'title arguments' => array(3), + 'title arguments' => array(4), 'access arguments' => array('administer menu'), 'type' => MENU_CALLBACK, 'file' => 'menu.admin.inc', ); - $items['admin/structure/menu-customize/%menu/list'] = array( + $items['admin/structure/menu/manage/%menu/list'] = array( 'title' => 'List links', 'weight' => -10, 'type' => MENU_DEFAULT_LOCAL_TASK, ); - $items['admin/structure/menu-customize/%menu/add'] = array( + $items['admin/structure/menu/manage/%menu/add'] = array( 'title' => 'Add link', 'page callback' => 'drupal_get_form', - 'page arguments' => array('menu_edit_item', 'add', NULL, 3), + 'page arguments' => array('menu_edit_item', 'add', NULL, 4), 'access arguments' => array('administer menu'), 'type' => MENU_LOCAL_ACTION, 'file' => 'menu.admin.inc', ); - $items['admin/structure/menu-customize/%menu/edit'] = array( + $items['admin/structure/menu/manage/%menu/edit'] = array( 'title' => 'Edit menu', 'page callback' => 'drupal_get_form', - 'page arguments' => array('menu_edit_menu', 'edit', 3), + 'page arguments' => array('menu_edit_menu', 'edit', 4), 'access arguments' => array('administer menu'), 'type' => MENU_LOCAL_TASK, 'file' => 'menu.admin.inc', ); - $items['admin/structure/menu-customize/%menu/delete'] = array( + $items['admin/structure/menu/manage/%menu/delete'] = array( 'title' => 'Delete menu', 'page callback' => 'menu_delete_menu_page', - 'page arguments' => array(3), + 'page arguments' => array(4), 'access arguments' => array('administer menu'), 'type' => MENU_CALLBACK, 'file' => 'menu.admin.inc', @@ -168,7 +168,7 @@ function menu_theme() { function menu_enable() { menu_rebuild(); $base_link = db_query("SELECT mlid AS plid, menu_name FROM {menu_links} WHERE link_path = 'admin/structure/menu' AND module = 'system'")->fetchAssoc(); - $base_link['router_path'] = 'admin/structure/menu-customize/%'; + $base_link['router_path'] = 'admin/structure/menu/manage/%'; $base_link['module'] = 'menu'; $result = db_query("SELECT * FROM {menu_custom}", array(), array('fetch' => PDO::FETCH_ASSOC)); foreach ($result as $menu) { @@ -176,7 +176,7 @@ function menu_enable() { $link = $base_link; $link['mlid'] = 0; $link['link_title'] = $menu['title']; - $link['link_path'] = 'admin/structure/menu-customize/' . $menu['menu_name']; + $link['link_path'] = 'admin/structure/menu/manage/' . $menu['menu_name']; $menu_link = db_query("SELECT mlid FROM {menu_links} WHERE link_path = :path AND plid = :plid", array( ':path' => $link['link_path'], ':plid' => $link['plid'] diff --git a/modules/menu/menu.test b/modules/menu/menu.test index 005419e8d..c8b29b13c 100644 --- a/modules/menu/menu.test +++ b/modules/menu/menu.test @@ -148,7 +148,7 @@ class MenuTestCase extends DrupalWebTestCase { $title = $this->menu['title']; // Delete custom menu. - $this->drupalPost("admin/structure/menu-customize/$menu_name/delete", array(), t('Delete')); + $this->drupalPost("admin/structure/menu/manage/$menu_name/delete", array(), t('Delete')); $this->assertResponse(200); $this->assertRaw(t('The custom menu %title has been deleted.', array('%title' => $title)), t('Custom menu was deleted')); $this->assertFalse(menu_load($menu_name), 'Custom menu was deleted'); @@ -186,7 +186,7 @@ class MenuTestCase extends DrupalWebTestCase { // Note in the UI the 'mlid:x[hidden]' form element maps to enabled, or // NOT hidden. $edit['mlid:' . $item1['mlid'] . '[hidden]'] = TRUE; - $this->drupalPost('admin/structure/menu-customize/' . $item1['menu_name'], $edit, t('Save configuration')); + $this->drupalPost('admin/structure/menu/manage/' . $item1['menu_name'], $edit, t('Save configuration')); // Verify in the database. $hidden = db_query("SELECT hidden FROM {menu_links} WHERE mlid = :mlid", array(':mlid' => $item1['mlid']))->fetchField(); @@ -207,7 +207,7 @@ class MenuTestCase extends DrupalWebTestCase { */ function addMenuLink($plid = 0, $link = '<front>', $menu_name = 'navigation') { // View add menu link page. - $this->drupalGet("admin/structure/menu-customize/$menu_name/add"); + $this->drupalGet("admin/structure/menu/manage/$menu_name/add"); $this->assertResponse(200); $title = '!link_' . $this->randomName(16); @@ -222,7 +222,7 @@ class MenuTestCase extends DrupalWebTestCase { ); // Add menu link. - $this->drupalPost("admin/structure/menu-customize/$menu_name/add", $edit, t('Save')); + $this->drupalPost("admin/structure/menu/manage/$menu_name/add", $edit, t('Save')); $this->assertResponse(200); // Unlike most other modules, there is no confirmation message displayed. @@ -259,7 +259,7 @@ class MenuTestCase extends DrupalWebTestCase { 'menu[link_path]' => $link_path, 'menu[link_title]' => 'title', ); - $this->drupalPost("admin/structure/menu-customize/$menu_name/add", $edit, t('Save')); + $this->drupalPost("admin/structure/menu/manage/$menu_name/add", $edit, t('Save')); $this->assertRaw(t("The path '@path' is either invalid or you do not have access to it.", array('@path' => $link_path)), 'Menu link was not created'); } } @@ -318,7 +318,7 @@ class MenuTestCase extends DrupalWebTestCase { // Unlike most other modules, there is no confirmation message displayed. // Verify menu link. - $this->drupalGet('admin/structure/menu-customize/' . $item['menu_name']); + $this->drupalGet('admin/structure/menu/manage/' . $item['menu_name']); $this->assertText($title, 'Menu link was edited'); } @@ -452,7 +452,7 @@ class MenuTestCase extends DrupalWebTestCase { } // View navigation menu customization node. - $this->drupalGet('admin/structure/menu-customize/navigation'); + $this->drupalGet('admin/structure/menu/manage/navigation'); $this->assertResponse($response); if ($response == 200) { $this->assertText(t('Navigation'), t('Navigation menu node was displayed')); |