You are here

function template_preprocess_ctools_wizard_trail_links in Chaos Tool Suite (ctools) 8.3

Template Preprocess for Trail links.

Parameters

$variables:

File

./ctools.module, line 66
Provides utility and helper APIs for Drupal developers and site builders.

Code

function template_preprocess_ctools_wizard_trail_links(&$variables) {

  /** @var $wizard \Drupal\ctools\Wizard\FormWizardInterface|\Drupal\ctools\Wizard\EntityFormWizardInterface */
  $wizard = $variables['wizard'];
  $cached_values = $variables['cached_values'];
  $trail = $variables['trail'];
  $variables['step'] = $wizard
    ->getStep($cached_values);
  foreach ($wizard
    ->getOperations($cached_values) as $step => $operation) {
    $parameters = $wizard
      ->getNextParameters($cached_values);

    // Override step to be the step we want.
    $parameters['step'] = $step;
    $trail[$step] = [
      'title' => !empty($operation['title']) ? $operation['title'] : '',
      'url' => new Url($wizard
        ->getRouteName(), $parameters),
    ];
  }
  $variables['trail'] = $trail;
}