diff --git a/core/modules/comment/src/Controller/AdminController.php b/core/modules/comment/src/Controller/AdminController.php index c6ffa11..76becb8 100644 --- a/core/modules/comment/src/Controller/AdminController.php +++ b/core/modules/comment/src/Controller/AdminController.php @@ -11,7 +11,6 @@ use Drupal\Core\Form\FormBuilderInterface; use Symfony\Component\HttpFoundation\Request; use Drupal\comment\CommentManagerInterface; -use Drupal\field\FieldInfo; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -22,16 +21,13 @@ class AdminController extends ControllerBase { /** * Constructs an AdminController object. * - * @param \Drupal\field\FieldInfo $field_info - * The field info service. * @param \Drupal\comment\CommentManagerInterface $comment_manager * The comment manager service. * @param \Drupal\Core\Form\FormBuilderInterface $form_builder * The form builder. */ - public function __construct(CommentManagerInterface $comment_manager, FieldInfo $field_info, FormBuilderInterface $form_builder) { + public function __construct(CommentManagerInterface $comment_manager, FormBuilderInterface $form_builder) { $this->commentManager = $comment_manager; - $this->fieldInfo = $field_info; $this->formBuilder = $form_builder; } @@ -41,7 +37,6 @@ public function __construct(CommentManagerInterface $comment_manager, FieldInfo public static function create(ContainerInterface $container) { return new static( $container->get('comment.manager'), - $container->get('field.info'), $container->get('form_builder') ); } @@ -67,63 +62,4 @@ public function adminPage(Request $request, $type = 'new') { } } - /** - * 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); - } - } diff --git a/core/modules/comment/src/Form/CommentAdminOverview.php b/core/modules/comment/src/Form/CommentAdminOverview.php index 610eb52..fb6fbb2 100644 --- a/core/modules/comment/src/Form/CommentAdminOverview.php +++ b/core/modules/comment/src/Form/CommentAdminOverview.php @@ -277,8 +277,9 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $cids = $form_state->getValue('comments'); if ($operation != 'delete') { foreach ($cids as $cid) { - // Delete operation handled in \Drupal\comment\Form\ConfirmDeleteMultiple - // see \Drupal\comment\Controller\AdminController::adminPage(). + // Delete operation handled in + // \Drupal\comment\Form\ConfirmDeleteMultiple + // @see \Drupal\comment\Controller\AdminController::adminPage(). if ($operation == 'unpublish') { $comment = $this->commentStorage->load($cid); $comment->setPublished(FALSE); @@ -297,8 +298,8 @@ public function submitForm(array &$form, FormStateInterface $form_state) { else { $this->tempStoreFactory ->get('comment_multiple_delete_confirm') - ->set(\Drupal::currentUser() - ->id(), $this->commentStorage->loadMultiple($cids)); + ->set($this->currentUser()->id(), + $this->commentStorage->loadMultiple($cids)); $form_state->setRedirect('comment.multiple_delete_confirm'); } }