diff --git a/core/modules/comment/lib/Drupal/comment/Form/CommentAdminOverview.php b/core/modules/comment/lib/Drupal/comment/Form/CommentAdminOverview.php index 52daa7e..bb65e87 100644 --- a/core/modules/comment/lib/Drupal/comment/Form/CommentAdminOverview.php +++ b/core/modules/comment/lib/Drupal/comment/Form/CommentAdminOverview.php @@ -177,8 +177,19 @@ public function buildForm(array $form, array &$form_state, $type = 'new') { $options = array(); $destination = drupal_get_destination(); + $commented_entity_ids = array(); + $commented_entities = array(); + + foreach ($comments as $comment) { + $commented_entity_ids[$comment->entity_type->value][] = $comment->entity_id->value; + } + + foreach ($commented_entity_ids as $entity_type => $ids) { + $commented_entities[$entity_type] = $this->entityManager->getStorageController($entity_type)->loadMultiple($ids); + } + foreach ($comments as $comment) { - $commented_entity = $this->entityManager->getStorageController($comment->entity_type->value)->load($comment->entity_id->value); + $commented_entity = $commented_entities[$comment->entity_type->value][$comment->entity_id->value]; $commented_entity_uri = $commented_entity->uri(); $username = array( '#theme' => 'username',