You are here

public function ConfigTranslationEntityListBuilder::render in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/config_translation/src/Controller/ConfigTranslationEntityListBuilder.php \Drupal\config_translation\Controller\ConfigTranslationEntityListBuilder::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 EntityListBuilder::render

File

core/modules/config_translation/src/Controller/ConfigTranslationEntityListBuilder.php, line 33
Contains \Drupal\config_translation\Controller\ConfigTranslationEntityListBuilder.

Class

ConfigTranslationEntityListBuilder
Defines the configuration translation list builder for entities.

Namespace

Drupal\config_translation\Controller

Code

public function render() {
  $build = parent::render();
  $filter = $this
    ->getFilterLabels();
  usort($build['table']['#rows'], array(
    $this,
    'sortRows',
  ));
  $build['filters'] = array(
    '#type' => 'container',
    '#attributes' => array(
      'class' => array(
        'table-filter',
        'js-show',
      ),
    ),
    '#weight' => -10,
  );
  $build['filters']['text'] = array(
    '#type' => 'search',
    '#title' => $this
      ->t('Search'),
    '#size' => 30,
    '#placeholder' => $filter['placeholder'],
    '#attributes' => array(
      'class' => array(
        'table-filter-text',
      ),
      'data-table' => '.config-translation-entity-list',
      'autocomplete' => 'off',
      'title' => $filter['description'],
    ),
  );
  $build['table']['#attributes']['class'][] = 'config-translation-entity-list';
  $build['table']['#weight'] = 0;
  $build['#attached']['library'][] = 'system/drupal.system.modules';
  return $build;
}