You are here

public function MultigraphListBuilder::buildRow in Monitoring 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

modules/multigraph/src/MultigraphListBuilder.php, line 33
Contains \Drupal\monitoring_multigraph\MultigraphListBuilder.

Class

MultigraphListBuilder
Defines a class to build a listing of monitoring multigraphs.

Namespace

Drupal\monitoring_multigraph

Code

public function buildRow(EntityInterface $entity) {

  /** @var \Drupal\monitoring_multigraph\Entity\Multigraph $entity */
  $row['label'] = $entity
    ->label();
  $row['description'] = $entity
    ->getDescription();

  // Format sensors list.
  $row['sensors'] = array();
  foreach ($entity
    ->getSensors() as $sensor) {
    $row['sensors'][] = $sensor
      ->label();
  }
  $row['sensors'] = implode(', ', $row['sensors']);
  return $row + parent::buildRow($entity);
}