You are here

public function GroupContentListBuilder::buildRow in Group 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/Controller/GroupContentListBuilder.php \Drupal\group\Entity\Controller\GroupContentListBuilder::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

See also

\Drupal\Core\Entity\EntityListBuilder::render()

File

src/Entity/Controller/GroupContentListBuilder.php, line 107

Class

GroupContentListBuilder
Provides a list controller for group content entities.

Namespace

Drupal\group\Entity\Controller

Code

public function buildRow(EntityInterface $entity) {

  /** @var \Drupal\group\Entity\GroupContentInterface $entity */
  $row['id'] = $entity
    ->id();

  // EntityListBuilder sets the table rows using the #rows property, so we
  // need to add links as render arrays using the 'data' key.
  $row['label']['data'] = $entity
    ->toLink()
    ->toRenderable();
  $entity_type_id = $entity
    ->getContentPlugin()
    ->getEntityTypeId();
  $row['entity_type'] = $this->entityTypeManager
    ->getDefinition($entity_type_id)
    ->getLabel();
  $row['plugin'] = $entity
    ->getContentPlugin()
    ->getLabel();
  return $row + parent::buildRow($entity);
}