function DraggableListBuilder::buildRow

Same name in other branches
  1. 9 core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php \Drupal\Core\Config\Entity\DraggableListBuilder::buildRow()

Overrides EntityListBuilder::buildRow

6 calls to DraggableListBuilder::buildRow()
DraggableListBuilder::buildForm in core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php
Form constructor.
FilterFormatListBuilder::buildRow in core/modules/filter/src/FilterFormatListBuilder.php
Builds a row for an entity in the entity listing.
LanguageListBuilder::buildRow in core/modules/language/src/LanguageListBuilder.php
Builds a row for an entity in the entity listing.
RoleListBuilder::buildRow in core/modules/user/src/RoleListBuilder.php
Builds a row for an entity in the entity listing.
SearchPageListBuilder::buildRow in core/modules/search/src/SearchPageListBuilder.php
Builds a row for an entity in the entity listing.

... See full list

5 methods override DraggableListBuilder::buildRow()
FilterFormatListBuilder::buildRow in core/modules/filter/src/FilterFormatListBuilder.php
Builds a row for an entity in the entity listing.
LanguageListBuilder::buildRow in core/modules/language/src/LanguageListBuilder.php
Builds a row for an entity in the entity listing.
RoleListBuilder::buildRow in core/modules/user/src/RoleListBuilder.php
Builds a row for an entity in the entity listing.
SearchPageListBuilder::buildRow in core/modules/search/src/SearchPageListBuilder.php
Builds a row for an entity in the entity listing.
VocabularyListBuilder::buildRow in core/modules/taxonomy/src/VocabularyListBuilder.php
Builds a row for an entity in the entity listing.

File

core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php, line 75

Class

DraggableListBuilder
Defines a class to build a draggable listing of configuration entities.

Namespace

Drupal\Core\Config\Entity

Code

public function buildRow(EntityInterface $entity) {
    $row = [];
    if (!empty($this->weightKey)) {
        // Override default values to markup elements.
        $row['#attributes']['class'][] = 'draggable';
        $row['#weight'] = $entity->get($this->weightKey);
        // Add weight column.
        $row['weight'] = [
            '#type' => 'weight',
            '#title' => t('Weight for @title', [
                '@title' => $entity->label(),
            ]),
            '#title_display' => 'invisible',
            '#default_value' => $entity->get($this->weightKey),
            '#attributes' => [
                'class' => [
                    'weight',
                ],
            ],
        ];
    }
    return $row + parent::buildRow($entity);
}

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