You are here

SiteSettingEntityTypeListBuilder.php in Site Settings and Labels 8

File

src/SiteSettingEntityTypeListBuilder.php
View source
<?php

namespace Drupal\site_settings;

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

/**
 * Provides a listing of Site Setting type entities.
 */
class SiteSettingEntityTypeListBuilder extends ConfigEntityListBuilder {

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
    $header['label'] = $this
      ->t('Site Setting type');
    $header['id'] = $this
      ->t('Machine name');
    return $header + parent::buildHeader();
  }

  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {
    $row['label'] = $entity
      ->label();
    $row['id'] = $entity
      ->id();
    return $row + parent::buildRow($entity);
  }

  /**
   * {@inheritdoc}
   */
  public function getOperations(EntityInterface $entity) {
    $operations = parent::getOperations($entity);
    $operations['replicate'] = [
      'title' => $this
        ->t('Replicate'),
      'url' => Url::fromRoute("site_settings.site_setting_replicate_form", [
        'setting' => $entity
          ->id(),
      ]),
      'weight' => 200,
    ];
    return $operations;
  }

}

Classes

Namesort descending Description
SiteSettingEntityTypeListBuilder Provides a listing of Site Setting type entities.