You are here

CslStyleListBuilder.php in Bibliography & Citation 8

Same filename and directory in other branches
  1. 2.0.x src/CslStyleListBuilder.php

Namespace

Drupal\bibcite

File

src/CslStyleListBuilder.php
View source
<?php

namespace Drupal\bibcite;

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

/**
 * Provides a listing of CSL style entities.
 */
class CslStyleListBuilder extends ConfigEntityListBuilder {

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

  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {

    /** @var \Drupal\bibcite\Entity\CslStyleInterface $entity */
    $row['id'] = $entity
      ->id();
    $row['label'] = $entity
      ->label();
    $row['status'] = $entity
      ->status() ? $this
      ->t('Enabled') : $this
      ->t('Disabled');
    return $row + parent::buildRow($entity);
  }

}

Classes

Namesort descending Description
CslStyleListBuilder Provides a listing of CSL style entities.