function 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
Entity form variant for adding workflow states.

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.