Builds a row for an entity in the entity listing.
\Drupal\Core\Entity\EntityInterface $entity: The entity for this row of the list.
array A render array structure of fields for this entity.
Overrides EntityListController::buildRow
Drupal\Core\Entity\EntityListController::render()
public function buildRow(EntityInterface $entity) {
$row = parent::buildRow($entity);
// Override default values to markup elements.
$row['#attributes']['class'][] = 'draggable';
unset($row['id']);
$row['label'] = array(
'#markup' => check_plain($row['label']),
);
$row['#weight'] = $entity
->get('weight');
// Add weight column.
$row['weight'] = array(
'#type' => 'weight',
'#title' => t('Weight for @title', array(
'@title' => $entity
->label(),
)),
'#title_display' => 'invisible',
'#default_value' => $entity
->get('weight'),
'#attributes' => array(
'class' => array(
'weight',
),
),
);
return $row;
}