DraggableListBuilder::buildRow

public DraggableListBuilder::buildRow(EntityInterface $entity)

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()

File

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

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 = array();
  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'] = array(
      '#type' => 'weight',
      '#title' => t('Weight for @title', array('@title' => $entity->label())),
      '#title_display' => 'invisible',
      '#default_value' => $entity->get($this->weightKey),
      '#attributes' => array('class' => array('weight')),
    );
  }
  return $row + parent::buildRow($entity);
}
doc_Drupal
2016-10-29 09:02:39
Comments
Leave a Comment

Please login to continue.