You are here

MessageDigestIntervalListBuilder.php in Message Digest 8

File

src/MessageDigestIntervalListBuilder.php
View source
<?php

namespace Drupal\message_digest;

use Drupal\Component\Utility\Xss;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;

/**
 * List builder for digest interval configs.
 */
class MessageDigestIntervalListBuilder extends EntityListBuilder {

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
    $header['label'] = t('Label');
    $header['interval'] = [
      'data' => t('interval'),
      'class' => [
        RESPONSIVE_PRIORITY_MEDIUM,
      ],
    ];
    return $header + parent::buildHeader();
  }

  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {
    $row['label'] = [
      'data' => $entity
        ->label(),
      'class' => [
        'menu-label',
      ],
    ];
    $row['interval'] = Xss::filterAdmin($entity
      ->getInterval());
    return $row + parent::buildRow($entity);
  }

}

Classes

Namesort descending Description
MessageDigestIntervalListBuilder List builder for digest interval configs.