{# /** * @file * Template for the structural pages menu block. * * Available variables: * - ancestor: The ancestor entity (term, user, or group). * - tree: Array of menu tree items, each containing: * - id: Node ID. * - title: Node title. * - url: Node URL. * - depth: Current depth level. * - children: Array of child items. * - entity: The node entity. * - active_trail: Array of node IDs in the active trail. * - show_ancestor_title: Whether to show the ancestor title as header. */ #} {{ attach_library('structural_pages/menu') }} {% if tree is not empty %} {% endif %} {% macro menu_item(item, active_trail, depth) %} {% set is_active = item.id in active_trail %} {% set has_children = item.children is not empty %} {% set classes = [ 'menu-item', 'structural-pages-menu__item', 'structural-pages-menu__item--level-' ~ depth, is_active ? 'menu-item--active-trail structural-pages-menu__item--active-trail', has_children ? 'menu-item--expanded structural-pages-menu__item--has-children', ] %} {{- item.title -}} {% if has_children %} {% endif %} {% endmacro %}