You are here

LogListBuilder.php in Log entity 2.x

Same filename and directory in other branches
  1. 8 src/LogListBuilder.php

Namespace

Drupal\log

File

src/LogListBuilder.php
View source
<?php

namespace Drupal\log;

use Drupal\Core\Entity\EntityInterface;
use Drupal\entity\BulkFormEntityListBuilder;

/**
 * Defines a class to build a listing of Log entities.
 *
 * @ingroup log
 */
class LogListBuilder extends BulkFormEntityListBuilder {

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
    $header['id'] = $this
      ->t('Log ID');
    $header['label'] = $this
      ->t('Label');
    $header['type'] = $this
      ->t('Type');
    return $header + parent::buildHeader();
  }

  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {

    /** @var \Drupal\log\Entity\LogInterface $entity */
    $row['id'] = [
      '#markup' => $entity
        ->id(),
    ];
    $row['name'] = $entity
      ->toLink($entity
      ->label(), 'canonical')
      ->toRenderable();
    $row['type'] = [
      '#markup' => $entity
        ->getBundleLabel(),
    ];
    return $row + parent::buildRow($entity);
  }

}

Classes

Namesort descending Description
LogListBuilder Defines a class to build a listing of Log entities.