1 {% extends "base/class.php.twig" %}
4 \Drupal\{{module}}\{{ entity_class }}ListBuilder.
7 {% block namespace_class %}
8 namespace Drupal\{{module}};
12 use Drupal\Core\Entity\EntityInterface;
13 use Drupal\Core\Entity\EntityListBuilder;
14 use Drupal\Core\Routing\LinkGeneratorTrait;
18 {% block class_declaration %}
20 * Defines a class to build a listing of {{ label }} entities.
22 * @ingroup {{ module }}
24 class {{ entity_class }}ListBuilder extends EntityListBuilder {% endblock %}
26 use LinkGeneratorTrait;
28 {% block class_methods %}
33 public function buildHeader() {
34 $header['id'] = $this->t('{{ label }} ID');
35 $header['name'] = $this->t('Name');
36 return $header + parent::buildHeader();
42 public function buildRow(EntityInterface $entity) {
43 /* @var $entity \Drupal\{{module}}\Entity\{{ entity_class }} */
44 $row['id'] = $entity->id();
45 $row['name'] = $this->l(
48 'entity.{{ entity_name }}.edit_form', array(
49 '{{ entity_name }}' => $entity->id(),
53 return $row + parent::buildRow($entity);