public function EventTypeListBuilder::buildRow in RNG - Events and Registrations 3.x
Same name and namespace in other branches
- 8.2 src/Lists/EventTypeListBuilder.php \Drupal\rng\Lists\EventTypeListBuilder::buildRow()
- 8 src/Lists/EventTypeListBuilder.php \Drupal\rng\Lists\EventTypeListBuilder::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/
Lists/ EventTypeListBuilder.php, line 87
Class
- EventTypeListBuilder
- Builds a list of event config entities.
Namespace
Drupal\rng\ListsCode
public function buildRow(EntityInterface $entity) {
/** @var \Drupal\rng\Entity\EventTypeInterface $entity **/
$entity_type = $this->entityManager
->getDefinition($entity
->getEventEntityTypeId());
$t_args = [
'@entity_type' => $entity_type
->getLabel(),
];
$bundle_entity_type = $entity_type
->getBundleEntityType();
if ($bundle_entity_type && $bundle_entity_type !== 'bundle') {
$bundle = $this->entityManager
->getStorage($entity_type
->getBundleEntityType())
->load($entity
->getEventBundle());
$t_args['@bundle'] = $bundle
->label();
$row['machine_name'] = $this
->t('@entity_type: @bundle', $t_args);
}
else {
// Entity type does not use bundles.
$row['machine_name'] = $this
->t('@entity_type', $t_args);
}
return $row + parent::buildRow($entity);
}