public function AssetInjectorListBuilder::buildRow in Asset Injector 8
Same name and namespace in other branches
- 8.2 src/AssetInjectorListBuilder.php \Drupal\asset_injector\AssetInjectorListBuilder::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/
AssetInjectorListBuilder.php, line 26
Class
- AssetInjectorListBuilder
- Provides a listing of Asset Injector entities.
Namespace
Drupal\asset_injectorCode
public function buildRow(EntityInterface $entity) {
$data['label'] = $entity
->label();
$data['id'] = $entity
->id();
$themes = $entity->themes;
if (empty($themes)) {
$data['themes'] = $this
->t('All');
}
else {
$data['themes'] = implode(', ', $themes);
}
$row = [
'class' => $entity
->status() ? 'enabled' : 'disabled',
'data' => $data + parent::buildRow($entity),
];
return $row;
}