turnstile

Drupal paywall plugin
Log | Files | Refs | README | LICENSE

PriceCategoryListBuilder.php (952B)


      1 <?php
      2 
      3 /**
      4  * @file
      5  * Location: src/PriceCategoryListBuilder.php
      6  *
      7  * List builder for price categories.
      8  */
      9 
     10 namespace Drupal\taler_turnstile;
     11 
     12 use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
     13 use Drupal\Core\Entity\EntityInterface;
     14 
     15 /**
     16  * Provides a listing of price categories.
     17  */
     18 class PriceCategoryListBuilder extends ConfigEntityListBuilder {
     19 
     20   /**
     21    * {@inheritdoc}
     22    */
     23   public function buildHeader() {
     24     $header['label'] = $this->t('Name');
     25     $header['id'] = $this->t('Machine name');
     26     $header['description'] = $this->t('Description');
     27     return $header + parent::buildHeader();
     28   }
     29 
     30   /**
     31    * {@inheritdoc}
     32    */
     33   public function buildRow(EntityInterface $entity) {
     34     /** @var \Drupal\taler_turnstile\Entity\TurnstilePriceCategory $entity */
     35     $row['label'] = $entity->label();
     36     $row['id'] = $entity->id();
     37     $row['description'] = $entity->getDescription();
     38     return $row + parent::buildRow($entity);
     39   }
     40 
     41 }