This repository has been archived on 2022-07-12. You can view files and clone it, but cannot push or open issues or pull requests.
opencase/modules/opencase_cases/src/OCCaseListBuilder.php

41 lines
860 B
PHP
Raw Normal View History

2018-04-29 11:58:46 +00:00
<?php
namespace Drupal\opencase_cases;
2018-04-29 11:58:46 +00:00
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
2018-04-29 11:58:46 +00:00
*/
class OCCaseListBuilder extends EntityListBuilder {
/**
* {@inheritdoc}
*/
public function buildHeader() {
$header['id'] = $this->t('Case ID');
$header['name'] = $this->t('Name');
return $header + parent::buildHeader();
}
/**
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity) {
/* @var $entity \Drupal\opencase_cases\Entity\OCCase */
2018-04-29 11:58:46 +00:00
$row['id'] = $entity->id();
$row['name'] = Link::createFromRoute(
$entity->label(),
'entity.oc_case.edit_form',
['oc_case' => $entity->id()]
);
return $row + parent::buildRow($entity);
}
}