public function EmbedButtonListBuilder::buildRow in Embed 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/
EmbedButtonListBuilder.php, line 30
Class
- EmbedButtonListBuilder
- Provides a listing of all Embed Button entities.
Namespace
Drupal\embedCode
public function buildRow(EntityInterface $entity) {
/** @var \Drupal\embed\EmbedButtonInterface $entity */
$row = [];
$row['label'] = $entity
->label();
$row['embed_type'] = $entity
->getTypeLabel();
if ($icon_url = $entity
->getIconUrl()) {
$row['icon']['data'] = [
'#theme' => 'image',
'#uri' => $icon_url,
'#alt' => $this
->t('Icon for the @label button.', [
'@label' => $entity
->label(),
]),
];
}
else {
$row['icon'] = $this
->t('None');
}
return $row + parent::buildRow($entity);
}