Commit 0f9eaa20 authored by Gerhard Killesreiter's avatar Gerhard Killesreiter
Browse files

#53870, better usability for admin/menu

parent 3000db0d
...@@ -343,7 +343,10 @@ function menu_edit_item_form($mid = 0) { ...@@ -343,7 +343,10 @@ function menu_edit_item_form($mid = 0) {
} }
else { else {
// This is an add form. // This is an add form.
$item = array('mid' => 0, 'pid' => 1, 'weight' => 0, 'type' => MENU_CUSTOM_ITEM); // The mid argument (if set) will be the default pid to use.
// Otherwise, we default to the "Navigation" menu (pid #1).
$default_pid = $mid ? $mid : 1;
$item = array('mid' => 0, 'pid' => $default_pid, 'weight' => 0, 'type' => MENU_CUSTOM_ITEM);
} }
$form['title'] = array('#type' => 'textfield', $form['title'] = array('#type' => 'textfield',
...@@ -382,7 +385,6 @@ function menu_edit_item_form($mid = 0) { ...@@ -382,7 +385,6 @@ function menu_edit_item_form($mid = 0) {
); );
// Generate a list of possible parents (not including this item or descendants). // Generate a list of possible parents (not including this item or descendants).
// Default to "Navigation" menu for new items.
$options = menu_parent_options($item['mid']); $options = menu_parent_options($item['mid']);
$form['pid'] = array('#type' => 'select', $form['pid'] = array('#type' => 'select',
'#title' => t('Parent item'), '#title' => t('Parent item'),
...@@ -606,6 +608,7 @@ function menu_overview_tree() { ...@@ -606,6 +608,7 @@ function menu_overview_tree() {
if ($menu['items'][$mid]['type'] & MENU_CREATED_BY_ADMIN) { if ($menu['items'][$mid]['type'] & MENU_CREATED_BY_ADMIN) {
$operations[] = l(t('delete'), 'admin/menu/menu/delete/'. $mid); $operations[] = l(t('delete'), 'admin/menu/menu/delete/'. $mid);
} }
$operations[] = l(t('add item'), 'admin/menu/item/add/'. $mid);
$table = theme('item_list', $operations); $table = theme('item_list', $operations);
$table .= theme('table', $header, menu_overview_tree_rows($mid)); $table .= theme('table', $header, menu_overview_tree_rows($mid));
$output .= theme('box', $title, $table); $output .= theme('box', $title, $table);
......
...@@ -343,7 +343,10 @@ function menu_edit_item_form($mid = 0) { ...@@ -343,7 +343,10 @@ function menu_edit_item_form($mid = 0) {
} }
else { else {
// This is an add form. // This is an add form.
$item = array('mid' => 0, 'pid' => 1, 'weight' => 0, 'type' => MENU_CUSTOM_ITEM); // The mid argument (if set) will be the default pid to use.
// Otherwise, we default to the "Navigation" menu (pid #1).
$default_pid = $mid ? $mid : 1;
$item = array('mid' => 0, 'pid' => $default_pid, 'weight' => 0, 'type' => MENU_CUSTOM_ITEM);
} }
$form['title'] = array('#type' => 'textfield', $form['title'] = array('#type' => 'textfield',
...@@ -382,7 +385,6 @@ function menu_edit_item_form($mid = 0) { ...@@ -382,7 +385,6 @@ function menu_edit_item_form($mid = 0) {
); );
// Generate a list of possible parents (not including this item or descendants). // Generate a list of possible parents (not including this item or descendants).
// Default to "Navigation" menu for new items.
$options = menu_parent_options($item['mid']); $options = menu_parent_options($item['mid']);
$form['pid'] = array('#type' => 'select', $form['pid'] = array('#type' => 'select',
'#title' => t('Parent item'), '#title' => t('Parent item'),
...@@ -606,6 +608,7 @@ function menu_overview_tree() { ...@@ -606,6 +608,7 @@ function menu_overview_tree() {
if ($menu['items'][$mid]['type'] & MENU_CREATED_BY_ADMIN) { if ($menu['items'][$mid]['type'] & MENU_CREATED_BY_ADMIN) {
$operations[] = l(t('delete'), 'admin/menu/menu/delete/'. $mid); $operations[] = l(t('delete'), 'admin/menu/menu/delete/'. $mid);
} }
$operations[] = l(t('add item'), 'admin/menu/item/add/'. $mid);
$table = theme('item_list', $operations); $table = theme('item_list', $operations);
$table .= theme('table', $header, menu_overview_tree_rows($mid)); $table .= theme('table', $header, menu_overview_tree_rows($mid));
$output .= theme('box', $title, $table); $output .= theme('box', $title, $table);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment