You are here

public function TransactionListBuilder::render in Transaction 8

Builds the entity listing as renderable array for table.html.twig.

@todo Add a link to add a new item to the #empty text.

Overrides EntityListBuilder::render

File

src/TransactionListBuilder.php, line 241

Class

TransactionListBuilder
Provides a entity list page for transactions.

Namespace

Drupal\transaction

Code

public function render() {
  $build = parent::render();
  $build['table']['#empty'] = $this->transactionType ? $this
    ->t('No @type transactions found for @target. <a href=":url">Create one</a>.', [
    '@type' => $this->transactionType
      ->label(),
    '@target' => $this->targetEntity
      ->label(),
    ':url' => Url::fromRoute('entity.transaction.add_form', [
      'transaction_type' => $this->transactionType
        ->id(),
      'target_entity_type' => $this->targetEntity
        ->getEntityTypeId(),
      'target_entity' => $this->targetEntity
        ->id(),
    ])
      ->toString(),
  ]) : $this
    ->t('No transactions found for @target.', [
    '@target' => $this->targetEntity
      ->label(),
  ]);
  return $build;
}