Added navigation illustration adapter for contents which only have a navigation illustration but no header illustration
authorThierry Florac <thierry.florac@onf.fr>
Tue, 26 Mar 2019 11:28:19 +0100
changeset 435 037188159ccc
parent 434 f703c55a3225
child 436 c72e9d8bfcda
Added navigation illustration adapter for contents which only have a navigation illustration but no header illustration
src/pyams_default_theme/component/illustration/__init__.py
--- a/src/pyams_default_theme/component/illustration/__init__.py	Mon Mar 18 16:54:47 2019 +0100
+++ b/src/pyams_default_theme/component/illustration/__init__.py	Tue Mar 26 11:28:19 2019 +0100
@@ -17,7 +17,7 @@
 from zope.location import Location
 from zope.schema.fieldproperty import FieldProperty
 
-from pyams_content.component.illustration import IBasicIllustrationTarget, ILinkIllustration
+from pyams_content.component.illustration import IBasicIllustrationTarget, ILinkIllustration, ILinkIllustrationTarget
 from pyams_content.component.illustration.interfaces import IIllustration
 from pyams_content.component.links import IInternalLink
 from pyams_content.features.renderer.interfaces import IContentRenderer
@@ -70,6 +70,14 @@
         return illustration
 
 
+@adapter_config(context=(ILinkIllustrationTarget, IPyAMSLayer), provides=IContentNavigationIllustration)
+def link_content_navigation_illustration_factory(context, request):
+    """Content navigation illustration adapter for basic link illustration targets"""
+    illustration = ILinkIllustration(context, None)
+    if illustration and illustration.has_data():
+        return illustration
+
+
 @adapter_config(context=(ISiteRoot, IPyAMSLayer), provides=IContentHeaderIllustration)
 @adapter_config(context=(IBaseContent, IPyAMSLayer), provides=IContentHeaderIllustration)
 def base_content_header_illustration_factory(context, request):