You are here

public function FormsStepsManager::getNextStepRoute in Forms Steps 8

Get the forms_steps next route step.

Parameters

mixed $route_name: Current route name.

Return value

null|string Returns the next route.

File

src/Service/FormsStepsManager.php, line 53

Class

FormsStepsManager
Class FormsStepsManager.

Namespace

Drupal\forms_steps\Service

Code

public function getNextStepRoute($route_name) {
  $nextRoute = NULL;
  $matches = self::getRouteParameters($route_name);
  if ($matches) {

    /** @var \Drupal\forms_steps\Entity\FormsSteps $formsSteps */
    $formsSteps = FormsSteps::load($matches[1]);
    if (!$formsSteps) {
      return $nextRoute;
    }
    $step = $formsSteps
      ->getStep($matches[2]);
    if (!$step) {
      return $nextRoute;
    }
    return $formsSteps
      ->getNextStepRoute($step);
  }
}