commit 6e7788aabf6be36fba4c51fbaa2279687338ab01 Author: Bart Feenstra Date: Thu Mar 27 13:27:46 2014 +0100 foo diff --git a/core/modules/comment/comment.local_tasks.yml b/core/modules/comment/comment.local_tasks.yml index 091321b..8826d1d 100644 --- a/core/modules/comment/comment.local_tasks.yml +++ b/core/modules/comment/comment.local_tasks.yml @@ -16,7 +16,7 @@ comment.confirm_delete_tab: comment.admin: title: Comments route_name: comment.admin - base_route: node.content_overview + base_route: system.admin_content comment.admin_new: title: 'Published comments' diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 103c5c8..bdb53c8 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -170,7 +170,7 @@ function comment_menu_link_defaults() { $links['comment.admin'] = array( 'link_title' => 'Comments', 'route_name' => 'comment.admin', - 'parent' => \Drupal::moduleHandler()->moduleExists('node') ? 'node.content_overview' : 'system.admin', + 'parent' => 'system.admin_content', 'description' => 'List and edit site comments and the comment approval queue.', ); $links['comment.bundle_list'] = array( @@ -184,16 +184,6 @@ function comment_menu_link_defaults() { } /** - * Implements hook_menu_link_defaults_alter() - */ -function comment_menu_link_defaults_alter(&$links) { - if (isset($links['node.content_overview'])) { - // Add comments to the description for admin/content if any. - $links['node.content_overview']['description'] = 'Administer content and comments.'; - } -} - -/** * Returns a menu title which includes the number of unapproved comments. * * @todo Move to the comment manager and replace by a entity query? diff --git a/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php b/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php index fada9bb..1373a9b 100644 --- a/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php +++ b/core/modules/node/lib/Drupal/node/Form/DeleteMultiple.php @@ -35,9 +35,9 @@ class DeleteMultiple extends ConfirmFormBase { protected $tempStoreFactory; /** - * The node storage. + * The node storage controller. * - * @var \Drupal\Core\Entity\EntityStorageInterface + * @var \Drupal\Core\Entity\EntityStorageControllerInterface */ protected $manager; @@ -51,7 +51,7 @@ class DeleteMultiple extends ConfirmFormBase { */ public function __construct(TempStoreFactory $temp_store_factory, EntityManagerInterface $manager) { $this->tempStoreFactory = $temp_store_factory; - $this->storage = $manager->getStorage('node'); + $this->storageController = $manager->getStorageController('node'); } /** @@ -118,14 +118,14 @@ public function buildForm(array $form, array &$form_state) { */ public function submitForm(array &$form, array &$form_state) { if ($form_state['values']['confirm'] && !empty($this->nodes)) { - $this->storage->delete($this->nodes); + $this->storageController->delete($this->nodes); $this->tempStoreFactory->get('node_multiple_delete_confirm')->delete(\Drupal::currentUser()->id()); $count = count($this->nodes); watchdog('content', 'Deleted @count posts.', array('@count' => $count)); drupal_set_message(format_plural($count, 'Deleted 1 post.', 'Deleted @count posts.')); Cache::invalidateTags(array('content' => TRUE)); } - $form_state['redirect_route']['route_name'] = 'node.content_overview'; + $form_state['redirect_route']['route_name'] = 'system.admin_content'; } } diff --git a/core/modules/node/lib/Drupal/node/Routing/RouteSubscriber.php b/core/modules/node/lib/Drupal/node/Routing/RouteSubscriber.php new file mode 100644 index 0000000..652b018 --- /dev/null +++ b/core/modules/node/lib/Drupal/node/Routing/RouteSubscriber.php @@ -0,0 +1,34 @@ +get('system.admin_content'); + if ($route) { + $route->setDefaults(array( + '_title' => 'Content', + '_entity_list' => 'node', + )); + $route->setRequirements(array( + '_permission' => 'access content overview', + )); + } + } + +} diff --git a/core/modules/node/node.local_actions.yml b/core/modules/node/node.local_actions.yml index af8a56d..b7b1577 100644 --- a/core/modules/node/node.local_actions.yml +++ b/core/modules/node/node.local_actions.yml @@ -7,4 +7,4 @@ node.add_page: route_name: node.add_page title: 'Add content' appears_on: - - node.content_overview + - system.admin_content diff --git a/core/modules/node/node.local_tasks.yml b/core/modules/node/node.local_tasks.yml index d3026e1..663d4aa 100644 --- a/core/modules/node/node.local_tasks.yml +++ b/core/modules/node/node.local_tasks.yml @@ -13,8 +13,8 @@ node.delete_confirm: weight: 10 node.content_overview: title: Content - route_name: node.content_overview - base_route: node.content_overview + route_name: system.admin_content + base_route: system.admin_content node.revision_overview: route_name: node.revision_overview base_route: node.view diff --git a/core/modules/node/node.module b/core/modules/node/node.module index cc53539..143be6d 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -108,7 +108,7 @@ function node_help($path, $arg) { $output .= '
' . t('Creating custom content types') . '
'; $output .= '
' . t('The Node module gives users with the Administer content types permission the ability to create new content types in addition to the default ones already configured. Creating custom content types allows you the flexibility to add fields and configure default settings that suit the differing needs of various site content.', array('!content-new' => \Drupal::url('node.type_add'), '!field' => \Drupal::url('help.page', array('name' => 'field')))) . '
'; $output .= '
' . t('Administering content') . '
'; - $output .= '
' . t('The Content administration page allows you to review and bulk manage your site content.', array('!content' => \Drupal::url('node.content_overview'))) . '
'; + $output .= '
' . t('The Content administration page allows you to review and bulk manage your site content.', array('!content' => \Drupal::url('system.admin_content'))) . '
'; $output .= '
' . t('Creating revisions') . '
'; $output .= '
' . t('The Node module also enables you to create multiple versions of any content, and revert to older versions using the Revision information settings.') . '
'; $output .= '
' . t('User permissions') . '
'; @@ -927,14 +927,6 @@ function _node_revision_access(NodeInterface $node, $op = 'view', $account = NUL * Implements hook_menu_link_defaults(). */ function node_menu_link_defaults() { - $links['node.content_overview'] = array( - 'link_title' => 'Content', - 'route_name' => 'node.content_overview', - 'parent' => 'system.admin', - 'description' => 'Find and manage content.', - 'weight' => -10, - ); - $links['node.overview_types'] = array( 'link_title' => 'Content types', 'parent' => 'system.admin_structure', diff --git a/core/modules/node/node.routing.yml b/core/modules/node/node.routing.yml index 617b16a..68927de 100644 --- a/core/modules/node/node.routing.yml +++ b/core/modules/node/node.routing.yml @@ -1,10 +1,3 @@ -node.content_overview: - path: '/admin/content' - defaults: - _title: 'Content' - _entity_list: 'node' - requirements: - _permission: 'access content overview' node.multiple_delete_confirm: path: '/admin/content/node/delete' diff --git a/core/modules/node/node.services.yml b/core/modules/node/node.services.yml index e211f7b..69cadb2 100644 --- a/core/modules/node/node.services.yml +++ b/core/modules/node/node.services.yml @@ -1,4 +1,8 @@ services: + node.route_subscriber: + class: Drupal\node\Routing\RouteSubscriber + tags: + - { name: event_subscriber } node.grant_storage: class: Drupal\node\NodeGrantDatabaseStorage arguments: ['@database', '@module_handler'] diff --git a/core/modules/system/lib/Drupal/system/Controller/SystemController.php b/core/modules/system/lib/Drupal/system/Controller/SystemController.php index 421791f..2e5d153 100644 --- a/core/modules/system/lib/Drupal/system/Controller/SystemController.php +++ b/core/modules/system/lib/Drupal/system/Controller/SystemController.php @@ -94,18 +94,21 @@ public static function create(ContainerInterface $container) { /** * Provide the administration overview page. * + * @param string $path + * The administrative path for which to display child links. + * * @return array * A renderable array of the administration overview page. */ - public function overview() { + public function overview($path) { // Check for status report errors. if ($this->systemManager->checkRequirements() && $this->currentUser()->hasPermission('administer site configuration')) { drupal_set_message($this->t('One or more problems were detected with your Drupal installation. Check the status report for more information.', array('@status' => url('admin/reports/status'))), 'error'); } $blocks = array(); - // Load all links on admin/config and menu links below it. + // Load all links on $path and menu links below it. $query = $this->queryFactory->get('menu_link') - ->condition('link_path', 'admin/config') + ->condition('link_path', $path) ->condition('module', 'system'); $result = $query->execute(); $menu_link_storage = $this->entityManager()->getStorage('menu_link'); diff --git a/core/modules/system/system.module b/core/modules/system/system.module index b746d01..497f09f 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -661,6 +661,14 @@ function system_menu_link_defaults() { 'menu_name' => 'admin', ); + $links['system.admin_content'] = array( + 'link_title' => 'Content', + 'route_name' => 'system.admin_content', + 'parent' => 'system.admin', + 'description' => 'Find and manage content.', + 'weight' => -10, + ); + // Menu items that are basically just menu blocks. $links['system.admin_structure'] = array( 'route_name' => 'system.admin_structure', diff --git a/core/modules/system/system.routing.yml b/core/modules/system/system.routing.yml index c790816..17327a4 100644 --- a/core/modules/system/system.routing.yml +++ b/core/modules/system/system.routing.yml @@ -381,6 +381,7 @@ system.admin_config: path: '/admin/config' defaults: _content: '\Drupal\system\Controller\SystemController::overview' + path: 'admin/config' _title: 'Configuration' requirements: _permission: 'access administration pages' @@ -407,3 +408,12 @@ system.batch_page.json: system.update: path: '/core/update.php' + +system.admin_content: + path: '/admin/content' + defaults: + _content: '\Drupal\system\Controller\SystemController::overview' + path: 'admin/content' + _title: 'Content' + requirements: + _permission: 'access administration pages'