You are here

TagSetListBuilder.php in Extensible BBCode 4.0.x

Same filename and directory in other branches
  1. 8.3 src/TagSetListBuilder.php

Namespace

Drupal\xbbcode

File

src/TagSetListBuilder.php
View source
<?php

namespace Drupal\xbbcode;

use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;

/**
 * Build a table view of tag sets.
 */
class TagSetListBuilder extends EntityListBuilder {

  /**
   * {@inheritdoc}
   */
  public function buildHeader() : array {
    $header['label'] = $this
      ->t('Name');
    $header['tags'] = $this
      ->t('Tags');
    return $header + parent::buildHeader();
  }

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

    /** @var \Drupal\xbbcode\Entity\TagSetInterface $entity */
    $row['tags']['data'] = $entity
      ->getPluginCollection()
      ->getSummary();
    return $row + parent::buildRow($entity);
  }

}

Classes

Namesort descending Description
TagSetListBuilder Build a table view of tag sets.