StatusListBuilder.php 958 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace Drupal\statusmessage;
  3. use Drupal\Core\Entity\EntityInterface;
  4. use Drupal\Core\Entity\EntityListBuilder;
  5. use Drupal\Core\Routing\LinkGeneratorTrait;
  6. use Drupal\Core\Url;
  7. /**
  8. * Defines a class to build a listing of Status entities.
  9. *
  10. * @ingroup statusmessage
  11. */
  12. class StatusListBuilder extends EntityListBuilder {
  13. use LinkGeneratorTrait;
  14. /**
  15. * {@inheritdoc}
  16. */
  17. public function buildHeader() {
  18. $header['id'] = $this->t('Status ID');
  19. $header['name'] = $this->t('Name');
  20. return $header + parent::buildHeader();
  21. }
  22. /**
  23. * {@inheritdoc}
  24. */
  25. public function buildRow(EntityInterface $entity) {
  26. /* @var $entity \Drupal\statusmessage\Entity\Status */
  27. $row['id'] = $entity->id();
  28. $row['name'] = $this->l(
  29. $entity->label(),
  30. new Url(
  31. 'entity.status.edit_form', array(
  32. 'status' => $entity->id(),
  33. )
  34. )
  35. );
  36. return $row + parent::buildRow($entity);
  37. }
  38. }