You are here

public function TransactionOperationListBuilder::buildRow in Transaction 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/TransactionOperationListBuilder.php, line 95

Class

TransactionOperationListBuilder
Provides a entity list page for transaction operations.

Namespace

Drupal\transaction

Code

public function buildRow(EntityInterface $entity) {

  /** @var \Drupal\transaction\TransactionOperationInterface $entity */
  $row = [];
  $row['id'] = [
    'data' => $entity
      ->id(),
  ];
  $row['label'] = [
    'data' => $entity
      ->label(),
    'class' => [
      'menu-label',
    ],
  ];
  $row['description'] = [
    'data' => !empty($description = $entity
      ->getDescription()) ? Unicode::truncate($description, 80, TRUE, TRUE) : $this
      ->notAvailableValue(),
  ];
  $row['details'] = [
    'data' => !empty($details = $entity
      ->getDetails()) ? $this
      ->formatPlural(count($details), '@count line', '@count lines') : $this
      ->notAvailableValue(),
  ];
  return $row + parent::buildRow($entity);
}