PriceListListBuilder.php in Commerce Pricelist 8
File
src/PriceListListBuilder.php
View source
<?php
namespace Drupal\commerce_pricelist;
use Drupal\Core\Url;
use Drupal\Core\Link;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
class PriceListListBuilder extends EntityListBuilder {
public function buildHeader() {
$header['id'] = $this
->t('Price list ID');
$header['name'] = $this
->t('Name');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$name_url = Url::fromRoute('entity.price_list.canonical', [
'price_list' => $entity
->id(),
]);
$name = Link::fromTextAndUrl($entity
->label(), $name_url);
$row['id'] = $entity
->id();
$row['name'] = $name;
return $row + parent::buildRow($entity);
}
}