public function ColorListBuilder::buildRow in Color API 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 EntityListBuilder::buildRow
See also
\Drupal\Core\Entity\EntityListBuilder::render()
File
- src/
Entity/ Builder/ ColorListBuilder.php, line 29
Class
- ColorListBuilder
- Provides a listing of Colors.
Namespace
Drupal\colorapi\Entity\BuilderCode
public function buildRow(EntityInterface $entity) {
$row['label'] = $entity
->label();
$row['id'] = $entity
->id();
$row['color'] = new FormattableMarkup('<div style="height:80%;width:80%;background-color:@color;"> </div>', [
'@color' => $entity
->getHexadecimal(),
]);
$row['hexadecimal'] = $entity
->getHexadecimal();
$row['rgb'] = $entity
->getRed() . ', ' . $entity
->getGreen() . ', ' . $entity
->getBlue();
return $row + parent::buildRow($entity);
}