layout_content-1.0.0-rc3/src/Entity/LayoutContentTypeListBuilder.php
src/Entity/LayoutContentTypeListBuilder.php
<?php
declare(strict_types = 1);
namespace Drupal\layout_content\Entity;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
/**
* Provides a layout content type list builder.
*
* This class helps build the layout content type list admin page.
*/
class LayoutContentTypeListBuilder extends ConfigEntityListBuilder {
/**
* {@inheritdoc}
*/
public function buildHeader(): array {
$header = [];
$header['label'] = $this->t('Layout type');
$header['id'] = $this->t('ID');
return $header + parent::buildHeader();
}
/**
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity): array {
$row['label'] = $entity->toLink(NULL, 'edit-form')->toString();
$row['id'] = $entity->id();
return $row + parent::buildRow($entity);
}
/**
* {@inheritdoc}
*/
protected function getTitle(): FormattableMarkup {
return $this->t('Custom layout types');
}
}
