a48e37ad39
so as not to conflict with Profile or Profile2 module on existing sites
41 lines
847 B
PHP
41 lines
847 B
PHP
<?php
|
|
|
|
namespace Drupal\zencrm_entities;
|
|
|
|
use Drupal\Core\Entity\EntityInterface;
|
|
use Drupal\Core\Entity\EntityListBuilder;
|
|
use Drupal\Core\Link;
|
|
|
|
/**
|
|
* Defines a class to build a listing of Hat entities.
|
|
*
|
|
* @ingroup zencrm_entities
|
|
*/
|
|
class HatListBuilder extends EntityListBuilder {
|
|
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function buildHeader() {
|
|
$header['id'] = $this->t('Hat ID');
|
|
$header['name'] = $this->t('Name');
|
|
return $header + parent::buildHeader();
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function buildRow(EntityInterface $entity) {
|
|
/* @var $entity \Drupal\zencrm_entities\Entity\Hat */
|
|
$row['id'] = $entity->id();
|
|
$row['name'] = Link::createFromRoute(
|
|
$entity->label(),
|
|
'entity.hat.edit_form',
|
|
['hat' => $entity->id()]
|
|
);
|
|
return $row + parent::buildRow($entity);
|
|
}
|
|
|
|
}
|