You are here

MediaBulkConfigListBuilder.php in Media Bulk Upload 8

File

src/MediaBulkConfigListBuilder.php
View source
<?php

namespace Drupal\media_bulk_upload;

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

/**
 * Provides a listing of Media Bulk Config entities.
 */
class MediaBulkConfigListBuilder extends ConfigEntityListBuilder {

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

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

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

  /**
   * {@inheritdoc}
   */
  public function render() {
    $build = parent::render();
    $build['table']['#empty'] = $this
      ->t('No media types available. <a href=":url">Add media type</a>.', [
      ':url' => Url::fromRoute('entity.media_bulk_config.add_form')
        ->toString(),
    ]);
    return $build;
  }

}

Classes

Namesort descending Description
MediaBulkConfigListBuilder Provides a listing of Media Bulk Config entities.