function CommentTypeListBuilder::buildRow

Same name and namespace in other branches
  1. 9 core/modules/comment/src/CommentTypeListBuilder.php \Drupal\comment\CommentTypeListBuilder::buildRow()
  2. 8.9.x core/modules/comment/src/CommentTypeListBuilder.php \Drupal\comment\CommentTypeListBuilder::buildRow()
  3. 11.x core/modules/comment/src/CommentTypeListBuilder.php \Drupal\comment\CommentTypeListBuilder::buildRow()

Builds a row for an entity in the entity listing.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity for this row of the list.

Return value

array A render array structure of fields for this entity.

Overrides EntityListBuilder::buildRow

File

core/modules/comment/src/CommentTypeListBuilder.php, line 70

Class

CommentTypeListBuilder
Defines a class to build a listing of comment type entities.

Namespace

Drupal\comment

Code

public function buildRow(EntityInterface $entity) {
  assert($entity instanceof CommentTypeInterface);
  $entity_type = $this->entityTypeManager
    ->getDefinition($entity->getTargetEntityTypeId());
  $row['type'] = $entity->label();
  $row['description']['data'] = [
    '#markup' => $entity->getDescription(),
  ];
  $row['target'] = $entity_type->getLabel();
  return $row + parent::buildRow($entity);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.