You are here

public function EnvironmentIndicatorListBuilder::buildRow in Environment Indicator 8.3

Same name and namespace in other branches
  1. 4.x src/EnvironmentIndicatorListBuilder.php \Drupal\environment_indicator\EnvironmentIndicatorListBuilder::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/EnvironmentIndicatorListBuilder.php, line 34

Class

EnvironmentIndicatorListBuilder
Provides a listing of environments.

Namespace

Drupal\environment_indicator

Code

public function buildRow(EntityInterface $entity) {

  /* @var \Drupal\environment_indicator\Entity\EnvironmentIndicator $entity */
  $row = [
    'style' => 'color: ' . $entity
      ->getFgColor() . '; background-color: ' . $entity
      ->getBgColor() . ';',
  ];
  $row['data']['name'] = [
    'data' => $entity
      ->label(),
  ];
  $row['data']['url'] = [
    'data' => $entity
      ->getUrl(),
  ];
  $row['data'] += parent::buildRow($entity);
  return $row;
}