function template_preprocess_ctools_wizard_trail_links

Same name in other branches
  1. 8.x-3.x ctools.module \template_preprocess_ctools_wizard_trail_links()

Template Preprocess for Trail links.

Parameters

$variables:

File

./ctools.module, line 69

Code

function template_preprocess_ctools_wizard_trail_links(&$variables) {
    
    /** @var \Drupal\ctools\Wizard\FormWizardInterface|\Drupal\ctools\Wizard\EntityFormWizardInterface $wizard */
    $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;
}