You are here

public function RateWidgetListBuilder::buildRow in Rate 8.2

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

src/RateWidgetListBuilder.php, line 47

Class

RateWidgetListBuilder
Defines a class to build a listing of rate widget entities.

Namespace

Drupal\rate

Code

public function buildRow(EntityInterface $entity) {
  $row['label'] = [
    'data' => $entity
      ->label(),
    'class' => [
      'menu-label',
    ],
  ];
  $row['id'] = $entity
    ->id();
  $row['template'] = $entity
    ->get('template');
  $row['value_type'] = $entity
    ->get('value_type');
  $row['entity_types'] = [
    'data' => [
      '#theme' => 'item_list',
      '#list_type' => 'ul',
      '#items' => $entity
        ->get('entity_types'),
    ],
  ];
  $row['comment_types'] = [
    'data' => [
      '#theme' => 'item_list',
      '#list_type' => 'ul',
      '#items' => $entity
        ->get('comment_types'),
    ],
  ];
  return $row + parent::buildRow($entity);
}