You are here

public function ConflictListBuilder::buildList in Workspace 8

Build the render array to display on the page.

Parameters

string $workspace_id: The workspace ID to build the conflict list for.

Return value

array A table render array to show on the page.

File

src/Controller/Component/ConflictListBuilder.php, line 224

Class

ConflictListBuilder
A list builder for entity revision conflicts.

Namespace

Drupal\workspace\Controller\Component

Code

public function buildList($workspace_id) {
  $build['table'] = [
    '#type' => 'table',
    '#header' => $this
      ->buildHeader(),
    '#title' => $this
      ->getTitle(),
    '#rows' => [],
    '#empty' => 'There are no conflicts.',
  ];
  $entities = $this
    ->load($workspace_id);
  foreach ($entities as $entity) {
    if ($row = $this
      ->buildRow($entity)) {
      $build['table']['#rows'][] = $row;
    }
  }

  // Only add the pager if a limit is specified.
  if (!empty($this->limit)) {
    $build['pager'] = [
      '#type' => 'pager',
    ];
  }
  return $build;
}