src/pyams_content/component/illustration/__init__.py
changeset 694 4541a452fd4c
parent 686 43ebbd99dd62
child 932 8e9a1496c2ba
--- a/src/pyams_content/component/illustration/__init__.py	Fri Jun 15 15:29:30 2018 +0200
+++ b/src/pyams_content/component/illustration/__init__.py	Fri Jun 15 18:18:16 2018 +0200
@@ -17,7 +17,8 @@
 
 # import interfaces
 from pyams_content.component.illustration.interfaces import IIllustration, IIllustrationTarget, \
-    ILLUSTRATION_KEY, ILLUSTRATION_RENDERERS, IBasicIllustration, IBasicIllustrationTarget, BASIC_ILLUSTRATION_KEY
+    ILLUSTRATION_KEY, ILLUSTRATION_RENDERERS, IBasicIllustration, IBasicIllustrationTarget, BASIC_ILLUSTRATION_KEY, \
+    ILinkIllustrationTarget, LINK_ILLUSTRATION_KEY, ILinkIllustration
 from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE
 from pyams_file.interfaces import IFileInfo, IImage, IResponsiveImage
 from pyams_i18n.interfaces import INegotiator, II18n, II18nManager
@@ -109,6 +110,20 @@
                                   callback=illustration_callback)
 
 
+@adapter_config(context=ILinkIllustrationTarget, provides=ILinkIllustration)
+@adapter_config(name='link', context=ILinkIllustrationTarget, provides=IIllustration)
+def link_illustration_factory(context):
+    """Link illustration factory"""
+
+    def illustration_callback(illustration):
+        get_current_registry().notify(ObjectAddedEvent(illustration, context, illustration.__name__))
+
+    return get_annotation_adapter(context, LINK_ILLUSTRATION_KEY, BasicIllustration,
+                                  markers=ILinkIllustration,
+                                  name='++illustration++link',
+                                  callback=illustration_callback)
+
+
 def update_illustration_properties(illustration):
     """Update missing file properties"""
     request = check_request()