[ 'variables' => [ 'wizard' => NULL, 'cached_values' => [], 'trail' => [], 'divider' => ' » ', 'step' => NULL, ], ], 'ctools_wizard_trail_links' => [ 'variables' => [ 'wizard' => NULL, 'cached_values' => [], 'trail' => [], 'divider' => ' » ', 'step' => NULL, ], ], ]; } /** * Template Preprocess for Wizard Trail. * * @param $variables */ function template_preprocess_ctools_wizard_trail(&$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) { $trail[$step] = !empty($operation['title']) ? $operation['title'] : ''; } $variables['trail'] = $trail; } /** * Template Preprocess for Trail links. * * @param $variables */ 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; } /** * Implements Hook Info alter. * * @param $definitions */ function ctools_condition_info_alter(&$definitions) { // If the node_type's class is unaltered, use a custom ctools implementation. if (isset($definitions['node_type']) && $definitions['node_type']['class'] == 'Drupal\node\Plugin\Condition\NodeType') { $definitions['node_type']['class'] = 'Drupal\ctools\Plugin\Condition\NodeType'; } // Replace all generic entity bundle conditions classes if they are unaltered, // these exist in Drupal 9.3+. foreach ($definitions as $id => $definition) { if (strpos($id, 'entity_bundle:') === 0 && $definition['class'] == CoreEntityBundle::class) { $definitions[$id]['class'] = EntityBundle::class; } } } /** * Implements hook_help(). */ function ctools_help($route_name, RouteMatchInterface $route_match) { switch ($route_name) { case 'help.page.ctools': $output = ''; $output .= '
' . t('This suite is primarily a set of APIs and tools to improve the developer experience. It also contains a module called the Page Manager whose job is to manage pages. In particular it manages panel pages, but as it grows it will be able to manage far more than just Panels.') . '
'; $output .= '' . t('For the moment, it includes the following tools:') . '
'; $output .= '