You are here

public function MediaGalleryListBuilder::buildRow in Media Gallery 8

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/MediaGalleryListBuilder.php, line 93

Class

MediaGalleryListBuilder
Provides a list controller for the media gallery entity type.

Namespace

Drupal\media_gallery

Code

public function buildRow(EntityInterface $entity) {

  /** @var \Drupal\media_gallery\MediaGalleryInterface $entity */
  $row['id'] = $entity
    ->id();
  $row['title'] = $entity
    ->toLink();
  $row['status'] = $entity
    ->isEnabled() ? $this
    ->t('Enabled') : $this
    ->t('Disabled');
  $row['uid']['data'] = [
    '#theme' => 'username',
    '#account' => $entity
      ->getOwner(),
  ];
  $row['created'] = $this->dateFormatter
    ->format($entity
    ->getCreatedTime());
  $row['changed'] = $this->dateFormatter
    ->format($entity
    ->getChangedTime());
  return $row + parent::buildRow($entity);
}