You are here

public function CheckoutFlowBase::getNextStepId in Commerce Core 8.2

Gets the next step ID for the given step ID.

Note that we’re not calling getVisibleSteps() on purpose here to bypass its static caching which may no longer be valid due to previous panes altering the order.

Parameters

string $step_id: The step ID.

Return value

string|null The next step ID, or NULL if there is none.

Overrides CheckoutFlowInterface::getNextStepId

2 calls to CheckoutFlowBase::getNextStepId()
CheckoutFlowBase::actions in modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowBase.php
Builds the actions element for the current form.
CheckoutFlowBase::submitForm in modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowBase.php
Form submission handler.

File

modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowBase.php, line 174

Class

CheckoutFlowBase
Provides the base checkout flow class.

Namespace

Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow

Code

public function getNextStepId($step_id) {
  $step_ids = array_keys($this
    ->getSteps());
  $next_step_index = array_search($step_id, $step_ids) + 1;
  while (isset($step_ids[$next_step_index])) {
    if (!$this
      ->isStepVisible($step_ids[$next_step_index])) {
      $next_step_index++;
      continue;
    }
    return $step_ids[$next_step_index];
  }
  return NULL;
}