diff --git a/core/modules/comment/comment.routing.yml b/core/modules/comment/comment.routing.yml index 6273eb7669f..e3ad589dfb5 100644 --- a/core/modules/comment/comment.routing.yml +++ b/core/modules/comment/comment.routing.yml @@ -74,11 +74,9 @@ comment.bundle_list: requirements: _permission: 'administer comments' +# This route is only used by Field UI. comment.bundle: path: '/admin/structure/comments/manage/{bundle}' - defaults: - _content: 'Drupal\comment\Controller\AdminController::bundleInfo' - _title_callback: 'Drupal\comment\Controller\AdminController::bundleTitle' requirements: _access: 'FALSE' diff --git a/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php b/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php index b0c7cbec065..9682594fc92 100644 --- a/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php +++ b/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php @@ -184,65 +184,6 @@ class AdminController extends ControllerBase { return $build; } - /** - * Returns an overview of the entity types a comment field is attached to. - * - * @param string $commented_entity_type - * The entity type to which the comment field is attached. - * @param string $field_name - * The comment field for which the overview is to be displayed. - * - * @return array - * A renderable array containing the list of entity types and bundle - * combinations on which the comment field is in use. - */ - public function bundleInfo($commented_entity_type, $field_name) { - // Add a link to manage entity fields if the Field UI module is enabled. - $field_ui_enabled = $this->moduleHandler()->moduleExists('field_ui'); - - $field_info = $this->fieldInfo->getField($commented_entity_type, $field_name); - - $entity_type_info = $this->entityManager()->getDefinition($commented_entity_type); - $entity_bundle_info = $this->entityManager()->getBundleInfo($commented_entity_type); - - $build['usage'] = array( - '#theme' => 'item_list', - '#title' => String::checkPlain($entity_type_info->getLabel()), - '#items' => array(), - ); - // Loop over all of bundles to which this comment field is attached. - foreach ($field_info->getBundles() as $bundle) { - // Add the current instance to the list of bundles. - if ($field_ui_enabled && $route_info = FieldUI::getOverviewRouteInfo($commented_entity_type, $bundle)) { - // Add a link to configure the fields on the given bundle and entity - // type combination. - $build['usage']['#items'][] = $this->l($entity_bundle_info[$bundle]['label'], $route_info['route_name'], $route_info['route_parameters']); - } - else { - // Field UI is disabled so fallback to a list of bundle labels - // instead of links to configure fields. - $build['usage']['#items'][] = String::checkPlain($entity_bundle_info[$bundle]['label']); - } - } - - return $build; - } - - /** - * Route title callback. - * - * @param string $commented_entity_type - * The entity type to which the comment field is attached. - * @param string $field_name - * The comment field for which the overview is to be displayed. - * - * @return string - * The human readable field name. - */ - public function bundleTitle($commented_entity_type, $field_name) { - return $this->commentManager->getFieldUIPageTitle($commented_entity_type, $field_name); - } - /** * Presents an administrative comment listing. *