function WorkflowStateAddForm::exists

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

Determines if the workflow state already exists.

Parameters

string $state_id: The workflow state ID.

Return value

bool TRUE if the workflow state exists, FALSE otherwise.

File

core/modules/workflows/src/Form/WorkflowStateAddForm.php, line 100

Class

WorkflowStateAddForm
Class WorkflowStateAddForm.

Namespace

Drupal\workflows\Form

Code

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

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