3 namespace Drupal\media_entity;
5 use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
6 use Drupal\Core\Entity\EntityHandlerInterface;
7 use Drupal\Core\Entity\EntityInterface;
8 use Drupal\Component\Utility\Xss;
12 * Provides a listing of media bundles.
14 class MediaBundleListBuilder extends ConfigEntityListBuilder implements EntityHandlerInterface {
19 public function buildHeader() {
20 $header['title'] = $this->t('Name');
21 $header['description'] = [
22 'data' => $this->t('Description'),
23 'class' => [RESPONSIVE_PRIORITY_MEDIUM],
25 return $header + parent::buildHeader();
31 public function buildRow(EntityInterface $entity) {
33 'data' => $entity->label(),
34 'class' => ['menu-label'],
36 $row['description'] = Xss::filterAdmin($entity->getDescription());
37 return $row + parent::buildRow($entity);
43 public function render() {
44 $build = parent::render();
45 $build['#empty'] = $this->t('No media bundle available. <a href="@link">Add media bundle</a>.', [
46 '@link' => Url::fromRoute('entity.media_bundle.add_form')->toString(),