You are here

page-manager-wizard-tree.html.twig in Page Manager 8.4

Same filename and directory in other branches
  1. 8 page_manager_ui/templates/page-manager-wizard-tree.html.twig

Default theme implementation to display wizard tree.

Available variables:

  • step: The current step name.
  • tree: A nested list of menu items. Each menu item contains:
    • title: The menu link title.
    • url: The menu link url, instance of \Drupal\Core\Url
    • children: The menu item child items.
    • step: The name of the step.

File

page_manager_ui/templates/page-manager-wizard-tree.html.twig
View source
  1. {#
  2. /**
  3. * @file
  4. * Default theme implementation to display wizard tree.
  5. *
  6. * Available variables:
  7. * - step: The current step name.
  8. * - tree: A nested list of menu items. Each menu item contains:
  9. * - title: The menu link title.
  10. * - url: The menu link url, instance of \Drupal\Core\Url
  11. * - children: The menu item child items.
  12. * - step: The name of the step.
  13. *
  14. * @ingroup themeable
  15. */
  16. #}
  17. {{ attach_library('page_manager_ui/page_variants') }}
  18. {% import _self as page_manager %}
  19. {#
  20. We call a macro which calls itself to render the full tree.
  21. @see http://twig.sensiolabs.org/doc/tags/macro.html
  22. #}
  23. {{ page_manager.wizard_tree(tree, step, 0) }}
  24. {% macro wizard_tree(items, step, menu_level) %}
  25. {% import _self as page_manager %}
  26. {% if items %}
  27. <ul class="page__section__{{ menu_level }}">
  28. {% for item in items %}
  29. {% if step is same as(item.step) %}
  30. {% set active_class = " current_variant" %}
  31. {% else %}
  32. {% set active_class = "" %}
  33. {% endif %}
  34. <li class="page__section_item__{{ menu_level }}{{ active_class }}">
  35. <label class="page__section__label">
  36. {% if item.url %}
  37. {% if step is same as(item.step) %}
  38. <strong>{{ link(item.title, item.url) }}</strong>
  39. {% else %}
  40. {{ link(item.title, item.url) }}
  41. {% endif %}
  42. {% else %}
  43. {{ item.title }}
  44. {% endif %}
  45. </label>
  46. {% if item.children %}
  47. {{ page_manager.wizard_tree(item.children, step, menu_level + 1) }}
  48. {% endif %}
  49. </li>
  50. {% endfor %}
  51. </ul>
  52. {% endif %}
  53. {% endmacro %}