You are here

public function WorkflowListBuilder::render in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/workflows/src/WorkflowListBuilder.php \Drupal\workflows\WorkflowListBuilder::render()

Builds the entity listing as renderable array for table.html.twig.

@todo Add a link to add a new item to the #empty text.

Overrides EntityListBuilder::render

File

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

Class

WorkflowListBuilder
Provides a listing of Workflow entities.

Namespace

Drupal\workflows

Code

public function render() {
  $build = parent::render();
  $workflow_types_count = count($this->workflowTypeManager
    ->getDefinitions());
  if ($workflow_types_count === 0) {
    $build['table']['#empty'] = $this
      ->t('There are no workflow types available. In order to create workflows you need to install a module that provides a workflow type. For example, the <a href=":content-moderation">Content Moderation</a> module provides a workflow type that enables workflows for content entities.', [
      ':content-moderation' => Url::fromRoute('system.modules_list', [], [
        'fragment' => 'module-content-moderation',
      ])
        ->toString(),
    ]);
  }
  return $build;
}