You are here

public function KeyListBuilder::buildRow in Key 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/Controller/KeyListBuilder.php, line 77

Class

KeyListBuilder
Provides a listing of keys.

Namespace

Drupal\key\Controller

Code

public function buildRow(EntityInterface $entity) {

  /* @var $key \Drupal\key\Entity\Key */
  $key = $entity;
  $row['label'] = $key
    ->label();
  $row['type'] = $key
    ->getKeyType()
    ->getPluginDefinition()['label'];
  $row['provider'] = $key
    ->getKeyProvider()
    ->getPluginDefinition()['label'];
  $overrides = $this
    ->getOverridesByKeyId($key
    ->id());
  $row['overrides']['data'] = [
    '#theme' => 'item_list',
    '#items' => $overrides,
  ];
  return $row + parent::buildRow($entity);
}