You are here

public function VocabularyListBuilder::render in Termcase 8

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 DraggableListBuilder::render

File

src/VocabularyListBuilder.php, line 86

Class

VocabularyListBuilder
Defines a class to build a listing of taxonomy vocabulary entities.

Namespace

Drupal\termcase

Code

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

  // If there are not multiple vocabularies, disable dragging by unsetting the
  // weight key.
  if (count($entities) <= 1) {
    unset($this->weightKey);
  }
  $build = parent::render();
  $build['table']['#empty'] = $this
    ->t('No vocabularies available. <a href=":link">Add vocabulary</a>.', [
    ':link' => Url::fromRoute('entity.taxonomy_vocabulary.add_form')
      ->toString(),
  ]);
  return $build;
}