You are here

FlexsliderListBuilder.php in Flex Slider 8.2

File

src/Controller/FlexsliderListBuilder.php
View source
<?php

namespace Drupal\flexslider\Controller;

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

/**
 * Provides a listing of Flexslider optionset entities.
 */
class FlexsliderListBuilder extends ConfigEntityListBuilder {

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
    $header['label'] = $this
      ->t('Name');
    $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 getDefaultOperations(EntityInterface $entity) {
    $ops = parent::getDefaultOperations($entity);

    // Do not allow deletion of the default configuration.
    if ($entity
      ->id() == 'default') {
      unset($ops['delete']);
    }
    return $ops;
  }

}

Classes

Namesort descending Description
FlexsliderListBuilder Provides a listing of Flexslider optionset entities.