You are here

public function UserConsentListBuilder::buildRow in Data Policy 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/UserConsentListBuilder.php, line 68

Class

UserConsentListBuilder
Defines a class to build a listing of User consent entities.

Namespace

Drupal\data_policy

Code

public function buildRow(EntityInterface $entity) {
  $owner = $entity
    ->getOwner();

  /* @var \Drupal\data_policy\Entity\UserConsentInterface $entity */
  return [
    'id' => $entity
      ->id(),
    'user' => $owner instanceof UserInterface ? $owner
      ->getDisplayName() : $this
      ->t('Deleted user'),
    'created' => $this->dateFormatter
      ->format($entity
      ->getChangedTime(), 'short'),
  ];
}