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 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'], 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;
}
doc_Drupal
2016-10-29 08:54:51
Comments
Leave a Comment

Please login to continue.