src/pyams_default_theme/shared/common/navigation.py
changeset 531 d900ecb7c6f6
parent 366 4c4b26c3972a
--- a/src/pyams_default_theme/shared/common/navigation.py	Fri Nov 13 13:24:29 2020 +0100
+++ b/src/pyams_default_theme/shared/common/navigation.py	Fri Nov 13 13:29:12 2020 +0100
@@ -16,21 +16,31 @@
 
 from pyams_content.interfaces import IBaseContent
 from pyams_content.shared.common import ISharedContent
-from pyams_default_theme.interfaces import IContentNavigationTitle
 from pyams_content.shared.site import ISiteElementNavigation
+from pyams_default_theme.interfaces import IContentHeader, IContentNavigationTitle
 from pyams_i18n.interfaces import II18n
+from pyams_sequence.interfaces import IInternalReference
 from pyams_skin.layer import IPyAMSUserLayer
 from pyams_utils.adapter import ContextRequestAdapter, ContextRequestViewAdapter, adapter_config
 from pyams_utils.interfaces.tales import ITALESExtension
 from pyams_workflow.interfaces import IWorkflowPublicationInfo
 
 
-@adapter_config(context=(IBaseContent, IPyAMSUserLayer), provides=IContentNavigationTitle)
+@adapter_config(context=(IBaseContent, IPyAMSUserLayer),
+                provides=IContentNavigationTitle)
 def shared_content_navigation_title(context, request):
     """Default content navigation title adapter"""
     return II18n(context).query_attribute('title', request=request)
 
 
+@adapter_config(context=(IInternalReference, IPyAMSUserLayer),
+                provides=IContentNavigationTitle)
+def internal_link_content_navigation_title(context, request):
+    """Internal link content navigation title adapter"""
+    registry = request.registry
+    return registry.queryMultiAdapter((context.target, request), IContentNavigationTitle)
+
+
 @adapter_config(name='pyams_title',
                 context=(Interface, Interface, Interface),
                 provides=ITALESExtension)
@@ -40,10 +50,25 @@
     def render(self, context=None):
         if context is None:
             context = self.context
-        return self.request.registry.queryMultiAdapter((context, self.request), IContentNavigationTitle)
+        return self.request.registry.queryMultiAdapter((context, self.request),
+                                                       IContentNavigationTitle)
 
 
-@adapter_config(context=(ISharedContent, IPyAMSUserLayer), provides=ISiteElementNavigation)
+@adapter_config(name='pyams_header',
+                context=(Interface, Interface, Interface),
+                provides=ITALESExtension)
+class PyAMSContentHeaderTALESExtension(ContextRequestViewAdapter):
+    """PyAMS content header TALES extension"""
+
+    def render(self, context=None):
+        if context is None:
+            context = self.context
+        return self.request.registry.queryMultiAdapter((context, self.request),
+                                                       IContentHeader)
+
+
+@adapter_config(context=(ISharedContent, IPyAMSUserLayer),
+                provides=ISiteElementNavigation)
 class SharedContentNavigationAdapter(ContextRequestAdapter):
     """Shared content navigation adapter"""