You are here

OrgListBuilder.php in RedHen CRM 8

Namespace

Drupal\redhen_org

File

modules/redhen_org/src/OrgListBuilder.php
View source
<?php

namespace Drupal\redhen_org;

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

/**
 * Defines a class to build a listing of Org entities.
 *
 * @ingroup redhen_org
 */
class OrgListBuilder extends EntityListBuilder {

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

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

    /* @var $entity \Drupal\redhen_org\Entity\Org */
    $row['type'] = $entity
      ->getType();
    $row['name'] = $entity
      ->toLink()
      ->toString();
    $row['status'] = $entity
      ->isActive() ? $this
      ->t('Active') : $this
      ->t('Inactive');
    return $row + parent::buildRow($entity);
  }

}

Classes

Namesort descending Description
OrgListBuilder Defines a class to build a listing of Org entities.