StoreListBuilder.php in Commerce Core 8.2
Namespace
Drupal\commerce_storeFile
modules/store/src/StoreListBuilder.phpView source
<?php
namespace Drupal\commerce_store;
use Drupal\commerce_store\Entity\StoreType;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
/**
* Defines the list builder for stores.
*/
class StoreListBuilder extends EntityListBuilder {
/**
* {@inheritdoc}
*/
public function buildHeader() {
$header['name'] = $this
->t('Name');
$header['type'] = $this
->t('Type');
return $header + parent::buildHeader();
}
/**
* {@inheritdoc}
*/
public function buildRow(EntityInterface $entity) {
/** @var \Drupal\commerce_store\Entity\StoreInterface $entity */
$store_type = StoreType::load($entity
->bundle());
$row['name']['data'] = [
'#type' => 'link',
'#title' => $entity
->label(),
] + $entity
->toUrl()
->toRenderArray();
$row['type'] = $store_type
->label();
return $row + parent::buildRow($entity);
}
}
Classes
Name | Description |
---|---|
StoreListBuilder | Defines the list builder for stores. |