You are here

public static function WorkflowManagerInterface::getCurrentStateId in Workflow 8

Gets the current state ID of a given entity.

There is no need to use a page cache. The performance is OK, and the cache gives problems when using Rules.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to check.

string $field_name: The name of the field of the entity to check. If empty, the field_name is determined on the spot. This must be avoided, since it makes having multiple workflow per entity unpredictable. The found field_name will be returned in the param.

Return value

string The ID of the current state.

1 method overrides WorkflowManagerInterface::getCurrentStateId()
WorkflowManager::getCurrentStateId in src/Entity/WorkflowManager.php
Gets the current state ID of a given entity.

File

src/Entity/WorkflowManagerInterface.php, line 140

Class

WorkflowManagerInterface
Provides an interface for workflow manager.

Namespace

Drupal\workflow\Entity

Code

public static function getCurrentStateId(EntityInterface $entity, $field_name = '');