function ConfigTranslationEntityListBuilder::render

Same name in other branches
  1. 8.9.x core/modules/config_translation/src/Controller/ConfigTranslationEntityListBuilder.php \Drupal\config_translation\Controller\ConfigTranslationEntityListBuilder::render()
  2. 10 core/modules/config_translation/src/Controller/ConfigTranslationEntityListBuilder.php \Drupal\config_translation\Controller\ConfigTranslationEntityListBuilder::render()
  3. 11.x core/modules/config_translation/src/Controller/ConfigTranslationEntityListBuilder.php \Drupal\config_translation\Controller\ConfigTranslationEntityListBuilder::render()

Overrides EntityListBuilder::render

File

core/modules/config_translation/src/Controller/ConfigTranslationEntityListBuilder.php, line 28

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'], [
        $this,
        'sortRows',
    ]);
    $build['filters'] = [
        '#type' => 'container',
        '#attributes' => [
            'class' => [
                'table-filter',
                'js-show',
            ],
        ],
        '#weight' => -10,
    ];
    $build['filters']['text'] = [
        '#type' => 'search',
        '#title' => $this->t('Search'),
        '#size' => 30,
        '#placeholder' => $filter['placeholder'],
        '#attributes' => [
            'class' => [
                '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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.