Added Event entity type.

This commit is contained in:
2021-01-28 10:22:20 +00:00
parent 53648faff7
commit b48ba012cb
36 changed files with 1353 additions and 0 deletions

View File

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