You are here

public function DeviceListBuilder::buildRow in Responsive Theme Preview 8

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 DraggableListBuilder::buildRow

See also

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

File

src/DeviceListBuilder.php, line 36

Class

DeviceListBuilder
Provides a listing of Device entities.

Namespace

Drupal\responsive_preview

Code

public function buildRow(EntityInterface $entity) {
  $row['label'] = $entity
    ->label();
  $row['status'] = [
    '#type' => 'checkbox',
    '#title' => $this
      ->t('Show %title in list', [
      '%title' => $entity
        ->label(),
    ]),
    '#title_display' => 'invisible',
    '#default_value' => $entity
      ->status(),
  ];
  $dimensions = $entity
    ->getDimensions();
  $row['dimensions']['#markup'] = new FormattableMarkup('@widthx@height (@dppx dppx)', [
    '@width' => $dimensions['width'],
    '@height' => $dimensions['height'],
    '@dppx' => $dimensions['dppx'],
  ]);
  return $row + parent::buildRow($entity);
}