public function EckEntityListBuilder::buildRow in Entity Construction Kit (ECK) 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/
Controller/ EckEntityListBuilder.php, line 41
Class
- EckEntityListBuilder
- Provides a list controller for ECK entity.
Namespace
Drupal\eck\ControllerCode
public function buildRow(EntityInterface $entity) {
$entityTypeId = $entity
->getEntityTypeId();
$entityBundle = $entity->type->entity;
$route = "entity.{$entityTypeId}.canonical";
$routeArguments = [
$entityTypeId => $entity
->id(),
];
$row['id'] = $entity
->id();
$row['title'] = new Link($entity
->label(), Url::fromRoute($route, $routeArguments));
$row['bundle'] = $entityBundle ? $entityBundle
->label() : '';
return array_merge($row, parent::buildRow($entity));
}