function WorkflowListBuilder::buildRow

Same name and namespace in other branches
  1. 9 core/modules/workflows/src/WorkflowListBuilder.php \Drupal\workflows\WorkflowListBuilder::buildRow()
  2. 8.9.x core/modules/workflows/src/WorkflowListBuilder.php \Drupal\workflows\WorkflowListBuilder::buildRow()
  3. 11.x core/modules/workflows/src/WorkflowListBuilder.php \Drupal\workflows\WorkflowListBuilder::buildRow()

Overrides EntityListBuilder::buildRow

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.