You are here

EmailListBuilder.php in Commerce Email 8

File

src/EmailListBuilder.php
View source
<?php

namespace Drupal\commerce_email;

use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;

/**
 * Defines the list builder for emails.
 */
class EmailListBuilder extends ConfigEntityListBuilder {

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
    $header['label'] = $this
      ->t('Email');
    $header['event'] = $this
      ->t('Event');
    $header['status'] = $this
      ->t('Status');
    return $header + parent::buildHeader();
  }

  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {

    /** @var \Drupal\commerce_email\Entity\EmailInterface $entity */
    $row['label'] = $entity
      ->label();
    $row['event'] = $entity
      ->getEvent()
      ->getLabel();
    $row['status'] = $entity
      ->status() ? $this
      ->t('Enabled') : $this
      ->t('Disabled');
    return $row + parent::buildRow($entity);
  }

}

Classes

Namesort descending Description
EmailListBuilder Defines the list builder for emails.