You are here

RngContactTypeListBuilder.php in RNG Contact 8

File

src/Lists/RngContactTypeListBuilder.php
View source
<?php

namespace Drupal\rng_contact\Lists;

use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;

/**
 * Builds a list of contact types.
 */
class RngContactTypeListBuilder extends ConfigEntityListBuilder {

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
    $header['label'] = $this
      ->t('Contact type');
    $header['machine_name'] = $this
      ->t('Machine Name');
    return $header + parent::buildHeader();
  }

  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {
    $row['label'] = $entity
      ->label();
    $row['machine_name'] = $entity
      ->id();
    return $row + parent::buildRow($entity);
  }

  /**
   * {@inheritdoc}
   */
  public function render() {
    $render = parent::render();
    $render['table']['#empty'] = t('No contact types found.');
    return $render;
  }

}

Classes

Namesort descending Description
RngContactTypeListBuilder Builds a list of contact types.