EasyEmailTypeListBuilder.php in Easy Email 8
File
src/EasyEmailTypeListBuilder.php
View source
<?php
namespace Drupal\easy_email;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Url;
class EasyEmailTypeListBuilder extends ConfigEntityListBuilder {
public function buildHeader() {
$header['label'] = $this
->t('Email 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 (!empty($operations['edit'])) {
$operations['edit']['title'] = $this
->t('Edit Template');
}
$operations['preview'] = [
'title' => $this
->t('Preview Template'),
'weight' => 15,
'url' => Url::fromRoute('entity.easy_email_type.preview', [
'easy_email_type' => $entity
->id(),
]),
];
return $operations;
}
}