public function WorkflowManager::getWorkflowByEntity in Forms Steps 8
Returns the first workflow entry of the provided entity.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: Entity instance to get the workflow from.
Return value
\Drupal\forms_steps\Entity\Workflow|null Returns the workflow if found, null otherwise.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
File
- src/
Service/ WorkflowManager.php, line 82
Class
- WorkflowManager
- Class WorkflowManager.
Namespace
Drupal\forms_steps\ServiceCode
public function getWorkflowByEntity(EntityInterface $entity) {
$workflow = NULL;
// We load all the workflow of that entity type & bundle.
$workflows = $this
->getAllWorksflowByEntity($entity);
// Only returning the first one.
if (!empty($workflows)) {
$workflow = reset($workflows);
}
return $workflow;
}