You are here

public function WorkflowListBuilder::buildRow in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/workflows/src/WorkflowListBuilder.php \Drupal\workflows\WorkflowListBuilder::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

core/modules/workflows/src/WorkflowListBuilder.php, line 72

Class

WorkflowListBuilder
Provides a listing of Workflow entities.

Namespace

Drupal\workflows

Code

public function buildRow(EntityInterface $entity) {

  /** @var \Drupal\workflows\WorkflowInterface $entity */
  $row['label'] = $entity
    ->label();
  $row['type']['data'] = [
    '#markup' => $entity
      ->getTypePlugin()
      ->label(),
  ];
  $items = array_map([
    State::class,
    'labelCallback',
  ], $entity
    ->getTypePlugin()
    ->getStates());
  $row['states']['data'] = [
    '#theme' => 'item_list',
    '#context' => [
      'list_style' => 'comma-list',
    ],
    '#items' => $items,
  ];
  return $row + parent::buildRow($entity);
}