ConfigTestListBuilder.php 711 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Drupal\config_test;
  3. use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
  4. use Drupal\Core\Entity\EntityInterface;
  5. /**
  6. * Defines a class to build a listing of ConfigTest entities.
  7. *
  8. * @see \Drupal\config_test\Entity\ConfigTest
  9. */
  10. class ConfigTestListBuilder extends ConfigEntityListBuilder {
  11. /**
  12. * {@inheritdoc}
  13. */
  14. public function buildHeader() {
  15. $header['label'] = t('Label');
  16. $header['id'] = t('Machine name');
  17. return $header + parent::buildHeader();
  18. }
  19. /**
  20. * {@inheritdoc}
  21. */
  22. public function buildRow(EntityInterface $entity) {
  23. $row['label'] = $entity->label();
  24. $row['id'] = $entity->id();
  25. return $row + parent::buildRow($entity);
  26. }
  27. }