12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace Drupal\statusmessage;
- use Drupal\Core\Entity\EntityInterface;
- use Drupal\Core\Entity\EntityListBuilder;
- use Drupal\Core\Routing\LinkGeneratorTrait;
- use Drupal\Core\Url;
- /**
- * Defines a class to build a listing of Status entities.
- *
- * @ingroup statusmessage
- */
- class StatusListBuilder extends EntityListBuilder {
- use LinkGeneratorTrait;
- /**
- * {@inheritdoc}
- */
- public function buildHeader() {
- $header['id'] = $this->t('Status ID');
- $header['name'] = $this->t('Name');
- return $header + parent::buildHeader();
- }
- /**
- * {@inheritdoc}
- */
- public function buildRow(EntityInterface $entity) {
- /* @var $entity \Drupal\statusmessage\Entity\Status */
- $row['id'] = $entity->id();
- $row['name'] = $this->l(
- $entity->label(),
- new Url(
- 'entity.status.edit_form', array(
- 'status' => $entity->id(),
- )
- )
- );
- return $row + parent::buildRow($entity);
- }
- }
|