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