<?php
namespace Drupal\opencase_cases;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
use Drupal\Core\Link;
/**
* Defines a class to build a listing of Case entities.
*
* @ingroup opencase_cases
*/
class OCCaseListBuilder extends EntityListBuilder {
* {@inheritdoc}
public function buildHeader() {
$header['id'] = $this->t('Case ID');
$header['name'] = $this->t('Name');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
/* @var $entity \Drupal\opencase_cases\Entity\OCCase */
$row['id'] = $entity->id();
$row['name'] = Link::createFromRoute(
$entity->label(),
'entity.oc_case.edit_form',
['oc_case' => $entity->id()]
);
return $row + parent::buildRow($entity);