public function PhotosImageListBuilder::buildRow in Album Photos 6.0.x
Same name and namespace in other branches
- 8.5 src/PhotosImageListBuilder.php \Drupal\photos\PhotosImageListBuilder::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/
PhotosImageListBuilder.php, line 91
Class
- PhotosImageListBuilder
- Defines a class to build a listing of photos_image entities.
Namespace
Drupal\photosCode
public function buildRow(EntityInterface $entity) {
/** @var \Drupal\photos\PhotosImageInterface $entity */
$langcode = $entity
->language()
->getId();
$uri = $entity
->toUrl();
$options = $uri
->getOptions();
$uri
->setOptions($options);
$row['title']['data'] = [
'#type' => 'link',
'#title' => $entity
->label(),
'#url' => $uri,
];
$album = $entity
->getAlbumId();
$row['album'] = $album;
$row['author']['data'] = [
'#theme' => 'username',
'#account' => $entity
->getOwner(),
];
$row['status'] = $entity
->isPublished() ? $this
->t('published') : $this
->t('not published');
$row['changed'] = $this->dateFormatter
->format($entity
->getChangedTime(), 'short');
$language_manager = \Drupal::languageManager();
if ($language_manager
->isMultilingual()) {
$row['language_name'] = $language_manager
->getLanguageName($langcode);
}
$row['operations']['data'] = $this
->buildOperations($entity);
return $row + parent::buildRow($entity);
}