loadedCommentedEntities)) { $result = $this->view->result; $entity_ids_per_type = []; foreach ($result as $value) { /** @var \Drupal\comment\CommentInterface $comment */ if ($comment = $this->getEntity($value)) { $entity_ids_per_type[$comment->getCommentedEntityTypeId()][] = $comment->getCommentedEntityId(); } } foreach ($entity_ids_per_type as $type => $ids) { $this->loadedCommentedEntities[$type] = $this->entityManager->getStorage($type)->loadMultiple($ids); } } return parent::getItems($values); } }