Add dynamic menu block based on site structure hierarchy

Implements SiteStructureMenuBlock that renders a navigation menu
from the ancestor entity (term, user, or group) through all
content_page hierarchies. Features configurable depth, active
trail highlighting, and proper cache invalidation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-03 20:13:51 -03:00
parent 8a42a6f1c1
commit a52f564192
6 changed files with 637 additions and 0 deletions

View File

@@ -191,6 +191,29 @@ function _site_structure_creates_circular_reference(int|string $node_id, int|str
return FALSE;
}
/**
* Implements hook_theme().
*/
function site_structure_theme(): array {
return [
'site_structure_menu' => [
'variables' => [
'ancestor' => NULL,
'tree' => [],
'active_trail' => [],
'show_ancestor_title' => TRUE,
],
],
'site_structure_menu_tree' => [
'variables' => [
'items' => [],
'active_trail' => [],
'depth' => 0,
],
],
];
}
/**
* Implements hook_token_info().
*/