--- a/src/pyams_skin/viewlet/menu/__init__.py Wed Oct 07 17:58:51 2015 +0200
+++ b/src/pyams_skin/viewlet/menu/__init__.py Wed Oct 07 17:59:52 2015 +0200
@@ -15,7 +15,7 @@
# import standard library
# import interfaces
-from pyams_skin.interfaces.viewlet import IMainMenusViewletManager, IMenu, IMenuItem
+from pyams_skin.interfaces.viewlet import IMainMenusViewletManager, IMenu, IMenuItem, IMenuHeader
from pyams_skin.layer import IPyAMSLayer
# import packages
@@ -45,12 +45,25 @@
class Menu(TemplateBasedViewletManager, WeightOrderedViewletManager, Viewlet):
"""Menu header"""
- header = FieldProperty(IMenu['header'])
+ _header = FieldProperty(IMenu['header'])
def __init__(self, context, request, view, manager=None):
WeightOrderedViewletManager.__init__(self, context, request, view)
Viewlet.__init__(self, context, request, view, manager)
+ @property
+ def header(self):
+ registry = self.request.registry
+ header = registry.queryMultiAdapter((self.context, self.request, self.__parent__, self), IMenuHeader)
+ if header is None:
+ header = registry.queryMultiAdapter((self.context, self.request, self), IMenuHeader)
+ if header is None:
+ header = registry.queryMultiAdapter((self.context, self), IMenuHeader)
+ if header is not None:
+ return header.header
+ else:
+ return self._header
+
def update(self):
WeightOrderedViewletManager.update(self)