You are here

public function EntityListBuilder::render in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Entity/EntityListBuilder.php \Drupal\Core\Entity\EntityListBuilder::render()

Builds the entity listing as renderable array for table.html.twig.

@todo Add a link to add a new item to the #empty text.

Overrides EntityListBuilderInterface::render

8 calls to EntityListBuilder::render()
ActionListBuilder::render in core/modules/action/src/ActionListBuilder.php
Builds the entity listing as renderable array for table.html.twig.
ConfigTranslationEntityListBuilder::render in core/modules/config_translation/src/Controller/ConfigTranslationEntityListBuilder.php
Builds the entity listing as renderable array for table.html.twig.
DraggableListBuilder::render in core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php
Builds the entity listing as renderable array for table.html.twig.
FieldConfigListBuilder::render in core/modules/field_ui/src/FieldConfigListBuilder.php
Builds the entity listing as renderable array for table.html.twig.
ImageStyleListBuilder::render in core/modules/image/src/ImageStyleListBuilder.php
Builds the entity listing as renderable array for table.html.twig.

... See full list

11 methods override EntityListBuilder::render()
ActionListBuilder::render in core/modules/action/src/ActionListBuilder.php
Builds the entity listing as renderable array for table.html.twig.
BlockListBuilder::render in core/modules/block/src/BlockListBuilder.php
ConfigTranslationEntityListBuilder::render in core/modules/config_translation/src/Controller/ConfigTranslationEntityListBuilder.php
Builds the entity listing as renderable array for table.html.twig.
DraggableListBuilder::render in core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php
Builds the entity listing as renderable array for table.html.twig.
EntityDisplayModeListBuilder::render in core/modules/field_ui/src/EntityDisplayModeListBuilder.php
Builds the entity listing as renderable array for table.html.twig.

... See full list

File

core/lib/Drupal/Core/Entity/EntityListBuilder.php, line 221
Contains \Drupal\Core\Entity\EntityListBuilder.

Class

EntityListBuilder
Defines a generic implementation to build a listing of entities.

Namespace

Drupal\Core\Entity

Code

public function render() {
  $build['table'] = array(
    '#type' => 'table',
    '#header' => $this
      ->buildHeader(),
    '#title' => $this
      ->getTitle(),
    '#rows' => array(),
    '#empty' => $this
      ->t('There is no @label yet.', array(
      '@label' => $this->entityType
        ->getLabel(),
    )),
    '#cache' => [
      'contexts' => $this->entityType
        ->getListCacheContexts(),
      'tags' => $this->entityType
        ->getListCacheTags(),
    ],
  );
  foreach ($this
    ->load() as $entity) {
    if ($row = $this
      ->buildRow($entity)) {
      $build['table']['#rows'][$entity
        ->id()] = $row;
    }
  }

  // Only add the pager if a limit is specified.
  if ($this->limit) {
    $build['pager'] = array(
      '#type' => 'pager',
    );
  }
  return $build;
}