diff --git a/core/modules/comment/lib/Drupal/comment/CommentTypeListBuilder.php b/core/modules/comment/lib/Drupal/comment/CommentTypeListBuilder.php index bd3a0d9..d347a71 100644 --- a/core/modules/comment/lib/Drupal/comment/CommentTypeListBuilder.php +++ b/core/modules/comment/lib/Drupal/comment/CommentTypeListBuilder.php @@ -10,6 +10,10 @@ use Drupal\Component\Utility\Xss; use Drupal\Core\Config\Entity\ConfigEntityListBuilder; use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Entity\EntityStorageInterface; +use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\Core\Utility\LinkGeneratorInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Defines a class to build a listing of comment type entities. @@ -19,6 +23,41 @@ class CommentTypeListBuilder extends ConfigEntityListBuilder { /** + * The link generator service. + * + * @var \Drupal\Core\Utility\LinkGeneratorInterface + */ + + protected $linkGenerator; + /** + * {@inheritdoc} + */ + public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { + return new static( + $entity_type, + $container->get('entity.manager')->getStorage($entity_type->id()), + $container->get('link_generator') + ); + } + + /** + * Constructs a new EntityListBuilder object. + * + * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type + * The entity type definition. + * @param \Drupal\Core\Entity\EntityStorageInterface $storage + * The entity storage class. + * @param \Drupal\Core\Utility\LinkGeneratorInterface $link_generator + * The link generator service. + */ + public function __construct(EntityTypeInterface $entity_type, EntityStorageInterface $storage, LinkGeneratorInterface $link_generator) { + $this->entityTypeId = $entity_type->id(); + $this->storage = $storage; + $this->entityType = $entity_type; + $this->linkGenerator = $link_generator; + } + + /** * {@inheritdoc} */ public function getDefaultOperations(EntityInterface $entity) { @@ -44,8 +83,8 @@ public function buildHeader() { * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { - $row['type'] = \Drupal::linkGenerator()->generateFromUrl($entity->label(), $entity->urlInfo()); - $row['description'] = Xss::filterAdmin($entity->description); + $row['type'] = $this->linkGenerator->generateFromUrl($entity->label(), $entity->urlInfo()); + $row['description'] = Xss::filterAdmin($entity->getDescription()); return $row + parent::buildRow($entity); }