You are here

public function FormsStepsHelper::getWorkflowInstanceIdFromRoute in Forms Steps 8

Get the workflow instance ID if in a current forms steps route.

Return value

false|string Return the Instance ID or FALSE otherwise.

File

src/Service/FormsStepsHelper.php, line 50

Class

FormsStepsHelper
Class FormsStepsHelper.

Namespace

Drupal\forms_steps\Service

Code

public function getWorkflowInstanceIdFromRoute() {
  $step = $this->formsStepsManager
    ->getStepByRoute($this->currentRouteMatch
    ->getRouteName());

  // Only return the workflow instance id if the current route is a forms
  // steps route.
  if ($step) {
    $instanceId = $this->currentRouteMatch
      ->getParameter('instance_id');
    return $instanceId;
  }
  return FALSE;
}