farm-2.x-dev/modules/core/asset/src/AssetTypeListBuilder.php
modules/core/asset/src/AssetTypeListBuilder.php
<?php namespace Drupal\asset; use Drupal\Core\Config\Entity\ConfigEntityListBuilder; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Url; /** * Provides a listing of asset type entities. */ class AssetTypeListBuilder extends ConfigEntityListBuilder { /** * {@inheritdoc} */ public function buildHeader() { $header['label'] = $this->t('Asset type'); $header['id'] = $this->t('Machine name'); return $header + parent::buildHeader(); } /** * {@inheritdoc} */ public function buildRow(EntityInterface $entity) { $row['label'] = $entity->label(); $row['id'] = $entity->id(); // You probably want a few more properties here... return $row + parent::buildRow($entity); } /** * {@inheritdoc} */ public function getDefaultOperations(EntityInterface $entity) { $operations = parent::getDefaultOperations($entity); // Place the edit operation after the operations added by field_ui.module // which have the weights 15, 20, 25. if (isset($operations['edit'])) { $operations['edit']['weight'] = 30; } return $operations; } /** * {@inheritdoc} */ public function render() { $build = parent::render(); $build['table']['#empty'] = $this->t('No asset types available. <a href=":link">Add asset type</a>.', [ ':link' => Url::fromRoute('entity.asset_type.add_form')->toString(), ]); return $build; } }