DataPolicyListBuilder.php in Data Policy 8
File
src/DataPolicyListBuilder.php
View source
<?php
namespace Drupal\data_policy;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
use Drupal\Core\Link;
class DataPolicyListBuilder extends EntityListBuilder {
public function buildHeader() {
$header['name'] = $this
->t('Name');
$header['id'] = $this
->t('Data policy ID');
$header['revisions'] = $this
->t('Revisions');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$row['name'] = Link::createFromRoute($entity
->label(), 'entity.data_policy.revision', [
'entity_id' => $entity
->id(),
'data_policy_revision' => $entity
->getRevisionId(),
]);
$row['id'] = $entity
->id();
$row['revisions'] = count($this->storage
->revisionIds($entity));
return $row + parent::buildRow($entity);
}
}