pm-4.1.x-dev/modules/pm_note/src/PmNoteTypeListBuilder.php
modules/pm_note/src/PmNoteTypeListBuilder.php
<?php
namespace Drupal\pm_note;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Url;
/**
* Defines a class to build a listing of Note type entities.
*
* @see \Drupal\pm_note\Entity\PmNoteType
*/
class PmNoteTypeListBuilder extends ConfigEntityListBuilder {
/**
* {@inheritdoc}
*/
public function buildHeader() {
$header = [];
$header['title'] = $this->t('Label');
return $header + parent::buildHeader();
}
/**
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity) {
$row = [];
$row['title'] = [
'data' => $entity->label(),
'class' => ['menu-label'],
];
return $row + parent::buildRow($entity);
}
/**
* {@inheritdoc}
*/
public function render() {
$build = parent::render();
$build['table']['#empty'] = $this->t(
'No Note types available. <a href=":link">Add Note type</a>.',
[':link' => Url::fromRoute('entity.pm_note_type.add_form')->toString()]
);
return $build;
}
}
