public function VocabularyListController::render

Implements \Drupal\Core\Entity\EntityListControllerInterface::render().

Builds the entity list as renderable array for theme_table().

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

Overrides EntityListController::render

File

drupal/core/modules/taxonomy/lib/Drupal/taxonomy/VocabularyListController.php, line 90
Contains \Drupal\taxonomy\VocabularyListController.

Class

VocabularyListController
Provides a listing of vocabularies.

Namespace

Drupal\taxonomy

Code

public function render() {
  $entities = $this
    ->load();
  if (count($entities) > 1) {

    // Creates a form for manipulating vocabulary weights if more then one
    // vocabulary exists.
    return drupal_get_form($this);
  }
  $build = array(
    '#theme' => 'table',
    '#header' => $this
      ->buildHeader(),
    '#rows' => array(),
    '#empty' => t('No vocabularies available. <a href="@link">Add vocabulary</a>.', array(
      '@link' => url('admin/structure/taxonomy/add'),
    )),
  );
  unset($build['#header']['weight']);
  foreach ($entities as $entity) {
    $row = parent::buildRow($entity);
    unset($row['id']);
    $build['#rows'][$entity
      ->id()] = $row;
  }
  return $build;
}