Added content link illustration adapter
authorThierry Florac <thierry.florac@onf.fr>
Tue, 16 Oct 2018 11:16:57 +0200
changeset 183 f543e56f0d07
parent 182 f419b942f7f4
child 184 6815147a533f
Added content link illustration adapter
src/pyams_default_theme/component/illustration/__init__.py
--- a/src/pyams_default_theme/component/illustration/__init__.py	Fri Oct 12 17:05:26 2018 +0200
+++ b/src/pyams_default_theme/component/illustration/__init__.py	Tue Oct 16 11:16:57 2018 +0200
@@ -24,10 +24,11 @@
 from pyams_content.features.renderer.skin import BaseContentRenderer
 from pyams_content.interfaces import IBaseContent
 from pyams_content.root import ISiteRoot
+from pyams_content.shared.site.interfaces import IContentLink
 from pyams_default_theme.component.illustration.interfaces import IIllustrationRenderer, IIllustrationWithZoomSettings, \
     ILLUSTRATION_AFTER_BODY, ILLUSTRATION_BEFORE_BODY
-from pyams_default_theme.interfaces import IContentHeaderIllustration, IContentNavigationIllustration, \
-    IContentBannerIllustration
+from pyams_default_theme.interfaces import IContentBannerIllustration, IContentHeaderIllustration, \
+    IContentNavigationIllustration
 from pyams_skin.layer import IPyAMSLayer
 from pyams_template.template import template_config
 from pyams_utils.adapter import ContextRequestViewAdapter, adapter_config, get_annotation_adapter
@@ -74,6 +75,14 @@
     return None
 
 
+@adapter_config(context=(IContentLink, IPyAMSLayer), provides=IContentNavigationIllustration)
+def content_link_illustration_factory(context, request):
+    """Content link illustration factory"""
+    target = context.target
+    if target is not None:
+        return request.registry.queryMultiAdapter((target, request), IContentNavigationIllustration)
+
+
 @adapter_config(name='pyams_illustration',
                 context=(Interface, Interface, Interface),
                 provides=ITALESExtension)