You are here

public function RuleListBuilder::render in JS injector 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

lib/Drupal/js_injector/RuleListBuilder.php, line 77
Contains \Drupal\js_injector\RuleListBuilder.

Class

RuleListBuilder
Defines a class to build a listing of js_injector_rule entities.

Namespace

Drupal\js_injector

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['#empty'] = t('No rules available. <a href="@link">Add rule</a>.', array(
    '@link' => url('admin/config/development/js-injector/add-rule'),
  ));
  return $build;
}