public 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
File
- core/lib/Drupal/Core/Entity/EntityListBuilder.php, line 216
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; }
Please login to continue.