You are here

EntityTestListBuilder.php in Drupal 10

Namespace

Drupal\entity_test

File

core/modules/system/tests/modules/entity_test/src/EntityTestListBuilder.php
View source
<?php

namespace Drupal\entity_test;

use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;

/**
 * Defines a class to build a listing of entity test entities.
 *
 * @see \Drupal\entity_test\Entity\EntityTest
 */
class EntityTestListBuilder extends EntityListBuilder {

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
    $header['label'] = t('Label');
    $header['id'] = t('Machine name');
    return $header + parent::buildHeader();
  }

  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {
    $row['label'] = $entity
      ->label();
    $row['id'] = $entity
      ->id();
    return $row + parent::buildRow($entity);
  }

}

Classes

Namesort descending Description
EntityTestListBuilder Defines a class to build a listing of entity test entities.