openlucius-2.0.0-alpha3/modules/entities/ol_post/src/OlPostListBuilder.php
modules/entities/ol_post/src/OlPostListBuilder.php
<?php
namespace Drupal\ol_post;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
use Drupal\Core\Link;
/**
* Defines a class to build a listing of OL Post entities.
*
* @ingroup ol_post
*/
class OlPostListBuilder extends EntityListBuilder {
/**
* {@inheritdoc}
*/
public function buildHeader() {
$header['id'] = $this->t('OL Post ID');
$header['name'] = $this->t('Name');
return $header + parent::buildHeader();
}
/**
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity) {
/* @var \Drupal\ol_post\Entity\OlPost $entity */
$row['id'] = $entity->id();
$row['name'] = Link::createFromRoute(
$entity->label(),
'entity.ol_post.edit_form',
['ol_post' => $entity->id()]
);
return $row + parent::buildRow($entity);
}
}
