You are here

public function Workflow::getState in Workflow 8

Gets a state for a given workflow.

Parameters

string $sid: A state ID.

Return value

\Drupal\workflow\Entity\WorkflowState A WorkflowState object.

Overrides WorkflowInterface::getState

File

src/Entity/Workflow.php, line 384

Class

Workflow
Workflow configuration entity to persistently store configuration.

Namespace

Drupal\workflow\Entity

Code

public function getState($sid) {
  $wid = $this
    ->id();
  $state = WorkflowState::load($sid);
  if (!$wid || $wid == $state
    ->getWorkflowId()) {
    return $state;
  }
  return NULL;
}