You are here

CookiesServiceEntityListBuilder.php in COOKiES Consent Management 1.0.x

Namespace

Drupal\cookies

File

src/CookiesServiceEntityListBuilder.php
View source
<?php

namespace Drupal\cookies;

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

/**
 * Provides a listing of Cookie service entity entities.
 */
class CookiesServiceEntityListBuilder extends ConfigEntityListBuilder {

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
    $header['label'] = $this
      ->t('COOKiES service entity');
    $header['id'] = $this
      ->t('Machine name');
    $header['group'] = $this
      ->t('Service Group');
    $header['enabled'] = $this
      ->t('Enabled');
    return $header + parent::buildHeader();
  }

  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {
    $row['label'] = $entity
      ->label();
    $row['id'] = $entity
      ->id();
    $row['group'] = $entity
      ->get('group');
    $row['enabled'] = $entity
      ->get('status') ? $this
      ->t('Enabled') : $this
      ->t('Disabled');

    // You probably want a few more properties here...
    return $row + parent::buildRow($entity);
  }

}

Classes

Namesort descending Description
CookiesServiceEntityListBuilder Provides a listing of Cookie service entity entities.