You are here

public function CivicrmEntityListBuilder::buildRow in CiviCRM Entity 8.3

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/CivicrmEntityListBuilder.php, line 33

Class

CivicrmEntityListBuilder

Namespace

Drupal\civicrm_entity

Code

public function buildRow(EntityInterface $entity) {
  if ($this->entityType
    ->hasKey('bundle')) {
    return [
      'id' => $entity
        ->id(),
      'bundle' => $entity
        ->bundle(),
      'label' => $entity
        ->toLink(),
    ] + parent::buildRow($entity);
  }
  return [
    'id' => $entity
      ->id(),
    'label' => $entity
      ->toLink(),
  ] + parent::buildRow($entity);
}