You are here

MicrositeListBuilder.php in Entity Reference Hierarchy 8.2

Same filename and directory in other branches
  1. 3.x modules/entity_hierarchy_microsite/src/MicrositeListBuilder.php

File

modules/entity_hierarchy_microsite/src/MicrositeListBuilder.php
View source
<?php

namespace Drupal\entity_hierarchy_microsite;

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

/**
 * Defines a class for a list builder for microsite entities.
 */
class MicrositeListBuilder extends EntityListBuilder {

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
    return [
      'name' => $this
        ->t('Name'),
      'home' => $this
        ->t('Home page'),
    ] + parent::buildHeader();
  }

  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {
    return [
      'name' => $entity
        ->toLink(NULL, 'edit-form'),
      'home' => $entity
        ->getHome() ? $entity
        ->getHome()
        ->toLink() : $this
        ->t('N/A'),
    ] + parent::buildRow($entity);
  }

}

Classes

Namesort descending Description
MicrositeListBuilder Defines a class for a list builder for microsite entities.