Classes
MenuHelpersMixin
Mixin providing menu helper methods for TemplateEngine.
Requires these attributes on the host clas…
MenuHelpersMixin
Mixin providing menu helper methods for TemplateEngine.
Requires these attributes on the host class:
- site: Site instance
- _menu_dict_cache: dict[str, list[dict]]
Attributes
| Name | Type | Description |
|---|---|---|
site |
Any |
|
_menu_dict_cache |
dict[str, list[dict[str, Any]]] |
Methods 1
invalidate_menu_cache
Invalidate the menu dict cache.
Call this after menus are rebuilt to ensure fr…
invalidate_menu_cache
def invalidate_menu_cache(self) -> None
Invalidate the menu dict cache.
Call this after menus are rebuilt to ensure fresh dicts are generated.
Internal Methods 2
_get_menu
Get menu items as dicts for template access (cached).
_get_menu
def _get_menu(self, menu_name: str = 'main') -> list[dict[str, Any]]
Get menu items as dicts for template access (cached).
Parameters 1
menu_name |
str |
Name of the menu to get (e.g., 'main', 'footer') |
Returns
List of menu item dicts Performance:list[dict[str, Any]]
— Menu dicts are cached to avoid repeated to_dict() calls on every
page render. Cache is invalidated when menus are rebuilt.
_get_menu_lang
Get menu items for a specific language (cached).
_get_menu_lang
def _get_menu_lang(self, menu_name: str = 'main', lang: str = '') -> list[dict[str, Any]]
Get menu items for a specific language (cached).
Parameters 2
menu_name |
str |
Name of the menu to get |
lang |
str |
Language code |
Returns
List of menu item dicts for the specified languagelist[dict[str, Any]]
—