diff --git a/core/modules/menu/menu.admin.inc b/core/modules/menu/menu.admin.inc index 8e7edd0..d21ad58 100644 --- a/core/modules/menu/menu.admin.inc +++ b/core/modules/menu/menu.admin.inc @@ -90,6 +90,20 @@ function menu_overview_form($form, &$form_state) { menu_tree_check_access($tree, $node_links); $menu_admin = FALSE; + // Inline the add link action so it displays right above the table of links. + // No access check needed, since this form has the same access restriction + // as adding menu items to the menu. + $form['inline_actions'] = array( + '#prefix' => '', + ); + $form['inline_actions']['add'] = array( + '#theme' => 'menu_local_action', + '#link' => array( + 'href' => 'admin/structure/menu/manage/' . $form_state['menu']->id() . '/add', + 'title' => t('Add link'), + ), + ); $form = array_merge($form, _menu_overview_tree_form($tree, $delta)); $form['#empty_text'] = t('There are no menu links yet. Add link.', array('@link' => url('admin/structure/menu/manage/' . $form_state['menu']->id() .'/add'))); @@ -282,6 +296,7 @@ function theme_menu_overview_form($variables) { if (empty($rows)) { $rows[] = array(array('data' => $form['#empty_text'], 'colspan' => '7')); } + $output .= drupal_render($form['inline_actions']); $output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'menu-overview'))); $output .= drupal_render_children($form); return $output; diff --git a/core/modules/menu/menu.module b/core/modules/menu/menu.module index 381800d..3b17c22 100644 --- a/core/modules/menu/menu.module +++ b/core/modules/menu/menu.module @@ -107,12 +107,13 @@ function menu_menu() { 'access arguments' => array('administer menu'), 'file' => 'menu.admin.inc', ); + // Not officially a local action, but displayed as such in + // menu_overview_form(). $items['admin/structure/menu/manage/%menu/add'] = array( 'title' => 'Add link', 'page callback' => 'drupal_get_form', '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/manage/%menu/edit'] = array(