TocTypeListBuilder.php in TOC API 8
File
src/TocTypeListBuilder.php
View source
<?php
namespace Drupal\toc_api;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
class TocTypeListBuilder extends ConfigEntityListBuilder {
public function buildHeader() {
$header['label'] = $this
->t('Name');
$header['template'] = $this
->t('Template');
$header['headers'] = $this
->t('Header(s)');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$options = $entity
->getOptions();
$row['label'] = $entity
->label();
$row['template'] = $options['template'];
if ($options['header_min'] != $options['header_max']) {
$row['header'] = '<h' . $options['header_min'] . '> to <h' . $options['header_max'] . '>';
}
else {
$row['header'] = '<h' . $options['header_min'] . '>';
}
return $row + parent::buildRow($entity);
}
}