You are here

public function WorkflowConfigTransitionRoleForm::buildHeader in Workflow 8

File

src/Form/WorkflowConfigTransitionRoleForm.php, line 28

Class

WorkflowConfigTransitionRoleForm
Defines a class to build a listing of Workflow Config Transitions entities.

Namespace

Drupal\workflow\Form

Code

public function buildHeader() {
  $header = [];
  $workflow = $this->workflow;
  $states = $workflow
    ->getStates($all = 'CREATION');
  if ($states) {
    $header['label_new'] = $this
      ->t('From \\ To');

    /** @var \Drupal\workflow\Entity\WorkflowState $state */
    foreach ($states as $state) {

      // Don't allow transition TO (creation).
      if (!$state
        ->isCreationState()) {
        $header[$state
          ->id()] = $this
          ->t('@label', [
          '@label' => $state
            ->label(),
        ]);
      }
    }
  }
  return $header;
}