You are here

public function HttpConfigRequestListBuilder::buildRow in HTTP Client Manager 8

Same name and namespace in other branches
  1. 8.2 src/HttpConfigRequestListBuilder.php \Drupal\http_client_manager\HttpConfigRequestListBuilder::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/HttpConfigRequestListBuilder.php, line 76

Class

HttpConfigRequestListBuilder
Provides a listing of Http Config Request entities.

Namespace

Drupal\http_client_manager

Code

public function buildRow(EntityInterface $entity) {
  $row['label'] = $entity
    ->label();
  $row['id'] = $entity
    ->id();
  $params = [];
  foreach ($entity
    ->getParameters() as $key => $value) {
    $params[$key] = $this
      ->t('@key: @value', [
      '@key' => $key,
      '@value' => is_array($value) ? json_encode($value, JSON_PRETTY_PRINT) : $value,
    ]);
  }
  $row['params']['data'] = [
    '#theme' => 'item_list',
    '#items' => $params,
  ];
  return $row + parent::buildRow($entity);
}