Back to WorkflowServiceTrait class

Method isWorkflowActive

public bool
isWorkflowActive
(mixed $context)
Check if the workflow is active
Parameters
  • string $context The context of the workflow
Returns
  • bool

Method isWorkflowActive - Source code

/**
 * Check if the workflow is active
 *
 * @param   string  $context  The context of the workflow
 *
 * @return boolean
 */
public function isWorkflowActive($context) : bool
{
    $parts = explode('.', $context);
    $config = ComponentHelper::getParams($parts[0]);
    if (!$config->get('workflow_enabled')) {
        return false;
    }
    $modelName = $this->getModelName($context);
    if (empty($modelName)) {
        return false;
    }
    $component = $this->getMVCFactory();
    $appName = Factory::getApplication()->getName();
    $model = $component->createModel($modelName, $appName, ['ignore_request' => true]);
    return $model instanceof WorkflowModelInterface;
}