You are here

FilebrowserListBuilder.php in Filebrowser 8

File

lib/Drupal/filebrowser/Entity/Controller/FilebrowserListBuilder.php
View source
<?php

/**
 * @file
 * Contains \Drupal\filebrowser\Entity\Controller\FilebrowserListBuilder.
 */
namespace Drupal\filebrowser\Entity\Controller;

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

/**
 * Provides a list controller for entity. Define header and row content for the FooBar listing. The 'Operations' links are added
 * automatically from the 'links' definition in the entityType annotation when the parent functions are called.
 */
class FilebrowserListBuilder extends EntityListBuilder {

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
    $header['id'] = t('FooBarID');
    $header['label'] = t('Label');
    $header['filebrowser_field'] = t('FilebrowserField');
    return $header + parent::buildHeader();
  }

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

    /* @var $entity \Drupal\filebrowser\Entity\Filebrowser */
    $row['id'] = $entity
      ->id();
    $row['label'] = l($this
      ->getLabel($entity), 'filebrowser/' . $entity
      ->id());
    $row['filebrowser_field'] = $entity
      ->getFilebrowserField();
    return $row + parent::buildRow($entity);
  }

}

Classes

Namesort descending Description
FilebrowserListBuilder Provides a list controller for entity. Define header and row content for the FooBar listing. The 'Operations' links are added automatically from the 'links' definition in the entityType annotation when the parent functions are called.