public function InstagramAccountListBuilder::buildRow in Instagram Feeds 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/
InstagramAccountListBuilder.php, line 76
Class
- InstagramAccountListBuilder
- Lists instagram_account entities.
Namespace
Drupal\instagram_feedsCode
public function buildRow(EntityInterface $entity) {
/** @var \Drupal\instagram_feeds\Entity\InstagramAccountInterface $entity */
$row = [];
foreach (array_keys($this
->getColumns()) as $field) {
$value = $entity
->get($field)
->first()
->getValue();
$row[$field]['data']['#markup'] = reset($value);
}
$row['uid']['data'] = [
'#theme' => 'username',
'#account' => $entity
->getOwner(),
];
$row['account'] = $entity
->toLink();
$row['status'] = empty($row['status']) ? $this
->t('Disabled') : $this
->t('Enabled');
$row['token_expiration']['data'] = $this
->dateFormatter()
->format($entity
->getTokenExpirationTime(), 'short');
return $row + parent::buildRow($entity);
}