4 * Implements hook_theme().
6 function ctools_theme($existing, $type, $theme, $path) {
8 'ctools_wizard_trail' => [
11 'cached_values' => [],
17 'ctools_wizard_trail_links' => [
20 'cached_values' => [],
29 function template_preprocess_ctools_wizard_trail(&$variables) {
30 /** @var $wizard \Drupal\ctools\Wizard\FormWizardInterface|\Drupal\ctools\Wizard\EntityFormWizardInterface */
31 $wizard = $variables['wizard'];
32 $cached_values = $variables['cached_values'];
33 $trail = $variables['trail'];
34 $variables['step'] = $wizard->getStep($cached_values);
35 foreach ($wizard->getOperations($cached_values) as $step => $operation) {
36 $trail[$step] = !empty($operation['title']) ? $operation['title'] : '';
38 $variables['trail'] = $trail;
41 function template_preprocess_ctools_wizard_trail_links(&$variables) {
42 /** @var $wizard \Drupal\ctools\Wizard\FormWizardInterface|\Drupal\ctools\Wizard\EntityFormWizardInterface */
43 $wizard = $variables['wizard'];
44 $cached_values = $variables['cached_values'];
45 $trail = $variables['trail'];
46 $variables['step'] = $wizard->getStep($cached_values);
47 foreach ($wizard->getOperations($cached_values) as $step => $operation) {
48 $parameters = $wizard->getNextParameters($cached_values);
49 // Override step to be the step we want.
50 $parameters['step'] = $step;
52 'title' => !empty($operation['title']) ? $operation['title'] : '',
53 'url' => new \Drupal\Core\Url($wizard->getRouteName(), $parameters),
56 $variables['trail'] = $trail;
59 function ctools_condition_info_alter(&$definitions) {
60 // If the node_type's class is unaltered, use a custom ctools implementation.
61 if (isset($definitions['node_type']) && $definitions['node_type']['class'] == 'Drupal\node\Plugin\Condition\NodeType') {
62 $definitions['node_type']['class'] = 'Drupal\ctools\Plugin\Condition\NodeType';