You are here

public function DraggableListBuilder::buildRow in Drupal 8

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

Builds a row for an entity in the entity listing.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity for this row of the list.

Return value

array A render array structure of fields for this entity.

Overrides EntityListBuilder::buildRow

See also

\Drupal\Core\Entity\EntityListBuilder::render()

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);
}