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