You are here

public function WorkflowStateAddForm::exists in Drupal 8

Same name and namespace in other branches
  1. 9 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);
}