You are here

public function UserRestrictionsListBuilder::buildRow in User restrictions 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/UserRestrictionsListBuilder.php, line 49

Class

UserRestrictionsListBuilder
Defines a class to build a listing of image style entities.

Namespace

Drupal\user_restrictions

Code

public function buildRow(EntityInterface $entity) {
  $row['label'] = $entity
    ->label();
  $row['type'] = $this->typeManager
    ->getType($entity
    ->getRuleType())
    ->getLabel();
  $row['pattern'] = $entity
    ->getPattern();
  $row['access_type'] = $entity
    ->getAccessType() ? $this
    ->t('Whitelisted') : $this
    ->t('Blacklisted');
  $row['expiry'] = $entity
    ->getExpiry() == UserRestrictions::NO_EXPIRY ? $this
    ->t('Never') : date('Y-m-d H:i:s', $entity
    ->getExpiry());
  return $row + parent::buildRow($entity);
}