You are here

public function ParagraphsSetListBuilder::buildRow in Paragraphs Sets 8.2

Same name and namespace in other branches
  1. 8 src/Controller/ParagraphsSetListBuilder.php \Drupal\paragraphs_sets\Controller\ParagraphsSetListBuilder::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()

File

src/Controller/ParagraphsSetListBuilder.php, line 30

Class

ParagraphsSetListBuilder
Provides a listing of ParagraphsSet.

Namespace

Drupal\paragraphs_sets\Controller

Code

public function buildRow(EntityInterface $entity) {
  $row['icon_file'] = [];
  if ($icon_url = $entity
    ->getIconUrl()) {
    $row['icon_file']['class'][] = 'paragraphs-set-icon';
    $row['icon_file']['data'] = [
      '#theme' => 'image',
      '#uri' => $icon_url,
      '#width' => 32,
      '#height' => 32,
    ];
  }
  $row['label'] = $entity
    ->label();
  $row['id'] = $entity
    ->id();
  $row['description']['data'] = [
    '#markup' => $entity
      ->getDescription(),
  ];
  return $row + parent::buildRow($entity);
}