OembedProviderBucketListBuilder.php in oEmbed Providers 2.x
File
src/OembedProviderBucketListBuilder.php
View source
<?php
namespace Drupal\oembed_providers;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;
class OembedProviderBucketListBuilder extends ConfigEntityListBuilder {
public function render() {
$build = parent::render();
$build['markup'] = [
'#markup' => $this
->t('<p>Provider buckets allow site builders to define groups of oEmbed providers. These buckets are automatically exposed as media sources.</p>'),
'#weight' => -10,
];
return $build;
}
public function buildHeader() {
$header['label'] = $this
->t('Bucket');
$header['id'] = $this
->t('Machine name');
$header['description'] = $this
->t('Description');
return $header + parent::buildHeader();
}
public function buildRow(EntityInterface $entity) {
$row['label'] = $entity
->label();
$row['id'] = $entity
->id();
$row['description'] = $entity
->get('description');
return $row + parent::buildRow($entity);
}
public function getDefaultOperations(EntityInterface $entity) {
$operations = parent::getDefaultOperations($entity);
$operations['edit'] = [
'title' => $this
->t('Edit'),
'weight' => 15,
'url' => $entity
->toUrl('edit-form'),
];
$operations['delete'] = [
'title' => $this
->t('Delete'),
'weight' => 15,
'url' => $entity
->toUrl('delete-form'),
];
return $operations;
}
}