You are here

public function GroupListBuilder::buildRow in Group 8

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

Class

GroupListBuilder
Provides a list controller for group entities.

Namespace

Drupal\group\Entity\Controller

Code

public function buildRow(EntityInterface $entity) {

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

  // EntityListBuilder sets the table rows using the #rows property, so we
  // need to add the render array using the 'data' key.
  $row['name']['data'] = $entity
    ->toLink()
    ->toRenderable();
  $row['type'] = $entity
    ->getGroupType()
    ->label();
  $row['status'] = $entity
    ->isPublished() ? $this
    ->t('Published') : $this
    ->t('Unpublished');
  $row['uid'] = $entity
    ->getOwner()
    ->label();
  return $row + parent::buildRow($entity);
}