BlogTypeListBuilder.php 866 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace Drupal\dr8_zth;
  3. use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
  4. use Drupal\Core\Entity\EntityInterface;
  5. /**
  6. * Class BlogTypeListBuilder is the list builder for BlogType entities.
  7. */
  8. class BlogTypeListBuilder extends ConfigEntityListBuilder {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function buildHeader() {
  13. $parentHeader = parent::buildHeader();
  14. $header = [
  15. $this->t('Type'),
  16. $this->t('Name'),
  17. $this->t('Description'),
  18. ];
  19. $ret = array_merge($header, $parentHeader);
  20. return $ret;
  21. }
  22. /**
  23. * {@inheritdoc}
  24. */
  25. public function buildRow(EntityInterface $entity) {
  26. assert($entity instanceof BlogTypeInterface);
  27. $row = [
  28. $entity->label(),
  29. $entity->id(),
  30. $entity->getDescription(),
  31. ];
  32. $ret = array_merge($row, parent::buildRow($entity));
  33. return $ret;
  34. }
  35. }