function WorkflowTransitionAddForm::exists

Same name in other branches
  1. 9 core/modules/workflows/src/Form/WorkflowTransitionAddForm.php \Drupal\workflows\Form\WorkflowTransitionAddForm::exists()
  2. 8.9.x core/modules/workflows/src/Form/WorkflowTransitionAddForm.php \Drupal\workflows\Form\WorkflowTransitionAddForm::exists()
  3. 10 core/modules/workflows/src/Form/WorkflowTransitionAddForm.php \Drupal\workflows\Form\WorkflowTransitionAddForm::exists()

Determines if the workflow transition already exists.

Parameters

string $transition_id: The workflow transition ID.

Return value

bool TRUE if the workflow transition exists, FALSE otherwise.

File

core/modules/workflows/src/Form/WorkflowTransitionAddForm.php, line 119

Class

WorkflowTransitionAddForm
Entity form variant for adding workflow transitions.

Namespace

Drupal\workflows\Form

Code

public function exists($transition_id) {
    
    /** @var \Drupal\workflows\WorkflowInterface $original_workflow */
    $original_workflow = \Drupal::entityTypeManager()->getStorage('workflow')
        ->loadUnchanged($this->getEntity()
        ->id());
    return $original_workflow->getTypePlugin()
        ->hasTransition($transition_id);
}

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