PlanTypeListBuilder.php in farmOS 2.x
File
modules/core/plan/src/PlanTypeListBuilder.php
View source
<?php
namespace Drupal\plan;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Url;
class PlanTypeListBuilder extends ConfigEntityListBuilder {
public function buildHeader() {
$header['label'] = $this
->t('Plan type');
$header['id'] = $this
->t('Machine name');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$row['label'] = $entity
->label();
$row['id'] = $entity
->id();
return $row + parent::buildRow($entity);
}
public function getDefaultOperations(EntityInterface $entity) {
$operations = parent::getDefaultOperations($entity);
if (isset($operations['edit'])) {
$operations['edit']['weight'] = 30;
}
return $operations;
}
public function render() {
$build = parent::render();
$build['table']['#empty'] = $this
->t('No plan types available. <a href=":link">Add plan type</a>.', [
':link' => Url::fromRoute('entity.plan_type.add_form')
->toString(),
]);
return $build;
}
}