You are here

public function WorkspaceListBuilder::buildRow in Workspace 8.2

Same name and namespace in other branches
  1. 8 src/WorkspaceListBuilder.php \Drupal\workspace\WorkspaceListBuilder::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/WorkspaceListBuilder.php, line 66

Class

WorkspaceListBuilder
Defines a class to build a listing of workspace entities.

Namespace

Drupal\workspace

Code

public function buildRow(EntityInterface $entity) {

  /** @var \Drupal\workspace\WorkspaceInterface $entity */
  $row['label'] = $this
    ->t('@label (@id)', [
    '@label' => $entity
      ->label(),
    '@id' => $entity
      ->id(),
  ]);
  $row['owner'] = $entity
    ->getOwner()
    ->getDisplayname();
  $active_workspace = $this->workspaceManager
    ->getActiveWorkspace()
    ->id();
  $row['status'] = $active_workspace == $entity
    ->id() ? $this
    ->t('Active') : $this
    ->t('Inactive');
  return $row + parent::buildRow($entity);
}