5 use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
7 use Drupal\Core\Entity\EntityInterface;
10 * Defines a class to build a listing of node type entities.
12 * @see \Drupal\node\Entity\NodeType
14 class NodeTypeListBuilder extends ConfigEntityListBuilder {
19 public function buildHeader() {
20 $header['title'] = t('Name');
21 $header['description'] = [
22 'data' => t('Description'),
23 'class' => [RESPONSIVE_PRIORITY_MEDIUM],
25 return $header + parent::buildHeader();
31 public function buildRow(EntityInterface $entity) {
33 'data' => $entity->label(),
34 'class' => ['menu-label'],
36 $row['description']['data'] = ['#markup' => $entity->getDescription()];
37 return $row + parent::buildRow($entity);
43 public function getDefaultOperations(EntityInterface $entity) {
44 $operations = parent::getDefaultOperations($entity);
45 // Place the edit operation after the operations added by field_ui.module
46 // which have the weights 15, 20, 25.
47 if (isset($operations['edit'])) {
48 $operations['edit']['weight'] = 30;
56 public function render() {
57 $build = parent::render();
58 $build['table']['#empty'] = $this->t('No content types available. <a href=":link">Add content type</a>.', [
59 ':link' => Url::fromRoute('node.type_add')->toString()