diff --git a/core/modules/menu/lib/Drupal/menu/MenuListController.php b/core/modules/menu/lib/Drupal/menu/MenuListController.php new file mode 100644 index 0000000..6d6be11 --- /dev/null +++ b/core/modules/menu/lib/Drupal/menu/MenuListController.php @@ -0,0 +1,67 @@ + array( + '#theme' => 'menu_admin_overview', + '#title' => $entity->label(), + '#name' => $entity->id(), + '#description' => $entity->description, + ), + ); + $row['operations']['data'] = $this->buildOperations($entity); + return $row; + } + + /** + * Implements Drupal\Core\Entity\EntityListController::getOperations(); + */ + public function getOperations(EntityInterface $menu) { + $uri = $menu->uri(); + $path = $uri['path'] . '/' . $menu->id(); + + $operations['list'] = array( + 'title' => t('list links'), + 'href' => $path, + 'weight' => 0, + ); + $operations['edit'] = array( + 'title' => t('edit menu'), + 'href' => $path . '/edit', + 'weight' => 5, + ); + $operations['add'] = array( + 'title' => t('add link'), + 'href' => $path . '/add', + 'weight' => 10, + ); + return $operations; + } + +} diff --git a/core/modules/menu/menu.admin.inc b/core/modules/menu/menu.admin.inc index 35e9c37..3afa3ff 100644 --- a/core/modules/menu/menu.admin.inc +++ b/core/modules/menu/menu.admin.inc @@ -12,42 +12,7 @@ * Menu callback which shows an overview page of all the custom menus and their descriptions. */ function menu_overview_page() { - $header = array(t('Title'), t('Operations')); - $rows = array(); - $menus = menu_load_all(); - foreach ($menus as $menu) { - $row = array(); - $row[] = array( - 'data' => array( - '#theme' => 'menu_admin_overview', - '#title' => $menu->label(), - '#name' => $menu->id(), - '#description' => $menu->description, - ), - ); - $links = array(); - $links['list'] = array( - 'title' => t('list links'), - 'href' => 'admin/structure/menu/manage/' . $menu->id(), - ); - $links['edit'] = array( - 'title' => t('edit menu'), - 'href' => 'admin/structure/menu/manage/' . $menu->id() . '/edit', - ); - $links['add'] = array( - 'title' => t('add link'), - 'href' => 'admin/structure/menu/manage/' . $menu->id() . '/add', - ); - $row[] = array( - 'data' => array( - '#type' => 'operations', - '#links' => $links, - ), - ); - $rows[] = $row; - } - - return theme('table', array('header' => $header, 'rows' => $rows)); + return entity_list_controller('menu')->render(); } /** @@ -55,16 +20,15 @@ function menu_overview_page() { * * @param $variables * An associative array containing: - * - title: The menu's title. + * - id: The menu's machine name. + * - label: The menu's label. * - description: The menu's description. * * @ingroup themeable */ function theme_menu_admin_overview($variables) { - $output = check_plain($variables['title']); - $output .= '