diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index a6cce13..fa8d9e8 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -16,6 +16,7 @@ use Drupal\comment\CommentInterface; use Drupal\comment\Entity\Comment; use Drupal\entity\Entity\EntityDisplay; +use Drupal\field\Field; use Drupal\field\FieldInstanceInterface; use Drupal\field\FieldInterface; use Drupal\file\FileInterface; @@ -107,6 +108,10 @@ function comment_help($path, $arg) { $output .= '
' . t("Comments from users who have the Skip comment approval permission are published immediately. All other comments are placed in the Unapproved comments queue, until a user who has permission to Administer comments publishes or deletes them. Published comments can be bulk managed on the Published comments administration page.", array('@comment-approval' => url('admin/content/comment/approval'), '@admin-comment' => url('admin/content/comment'))) . '
'; $output .= ''; return $output; + + case 'admin/structure/comments': + $output = '

' . t('This page provides a list of all comment forms on the site and allows you to manage the fields, form and display settings for each.') . '

'; + return $output; } } @@ -117,8 +122,11 @@ function comment_entity_bundle_info() { $bundles = array(); foreach (\Drupal::service('comment.manager')->getAllFields() as $entity_type => $fields) { foreach ($fields as $field_name => $field_info) { + $sample_bundle = reset($field_info['bundles']); + // We cannot use field info API here because it will result in recursion. + $config = \Drupal::config('field.field.' . $entity_type . '.' . $field_name); $bundles['comment'][$entity_type . '__' . $field_name] = array( - 'label' => $entity_type . '_' . $field_name, + 'label' => $config->get('label'), ); } } diff --git a/core/modules/comment/comment.routing.yml b/core/modules/comment/comment.routing.yml index 5b39be7..714d4a2 100644 --- a/core/modules/comment/comment.routing.yml +++ b/core/modules/comment/comment.routing.yml @@ -74,4 +74,4 @@ comment.bundle: _content: 'Drupal\comment\Controller\AdminController::bundleInfo' _title_callback: 'Drupal\comment\Controller\AdminController::bundleTitle' requirements: - _permission: 'administer comments' + _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 7b07738..b75730e 100644 --- a/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php +++ b/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php @@ -71,6 +71,7 @@ public function overviewBundles() { 'data' => $this->t('Used in'), 'class' => array(RESPONSIVE_PRIORITY_MEDIUM), ), + 'type' => $this->t('Type'), ); // Add a column for field UI operations if the Field UI module is enabled. @@ -93,11 +94,19 @@ public function overviewBundles() { $row = array( 'class' => $field_info->get('locked') ? array('field-disabled') : array(''), ); - $row['data']['field_name']['data'] = $field_info->get('locked') ? $this->t('@field_name (Locked)', array('@field_name' => $field_name)) : String::checkPlain($field_name); + + $bundles = $field_info->getBundles(); + $sample_bundle = reset($bundles); + $sample_instance = $this->fieldInfo->getInstance($entity_type, $sample_bundle, $field_name); + + $tokens = array( + '@label' => $sample_instance->label, + '@field_name' => $field_name, + ); + $row['data']['field_name']['data'] = $field_info->get('locked') ? $this->t('@label (@field_name) (Locked)', $tokens) : $this->t('@label (@field_name)', $tokens); $row['data']['usage']['data'] = array( '#theme' => 'item_list', - '#title' => String::checkPlain($entity_types[$entity_type]['label']), '#items' => array(), ); foreach ($field_info_map['bundles'] as $bundle) { @@ -112,6 +121,8 @@ public function overviewBundles() { } } + $row['data']['type']['data'] = String::checkPlain($entity_types[$entity_type]['label']); + if ($field_ui_enabled) { if ($this->currentUser()->hasPermission('administer comment fields')) { $links['fields'] = array( @@ -213,7 +224,10 @@ public function bundleTitle($field_name) { // @todo Provide dynamic routing to get entity type and field name. list($entity_type, $field) = explode('__', $field_name, 2); $field_info = $this->fieldInfo->getField($entity_type, $field); - return String::checkPlain($field_info->getFieldName()); + $bundles = $field_info->getBundles(); + $sample_bundle = reset($bundles); + $sample_instance = $this->fieldInfo->getInstance($entity_type, $sample_bundle, $field_name); + return String::checkPlain($sample_instance->label); } }