--- a/src/pyams_content/shared/imagemap/paragraph.py Thu May 24 10:51:45 2018 +0200
+++ b/src/pyams_content/shared/imagemap/paragraph.py Fri May 25 08:03:41 2018 +0200
@@ -18,16 +18,20 @@
# import interfaces
from pyams_content.component.paragraph.interfaces import IParagraphFactory
from pyams_content.features.checker.interfaces import IContentChecker, ERROR_VALUE, MISSING_VALUE, MISSING_LANG_VALUE
-from pyams_content.shared.imagemap.interfaces import IImageMapParagraph, IMAGEMAP_PARAGRAPH_TYPE
+from pyams_content.shared.imagemap.interfaces import IImageMapParagraph, IMAGEMAP_PARAGRAPH_TYPE, \
+ IMAGEMAP_PARAGRAPH_RENDERERS
from pyams_i18n.interfaces import II18nManager, INegotiator, II18n
from pyams_workflow.interfaces import IWorkflow, IWorkflowState
# import packages
from pyams_content.component.paragraph import BaseParagraph, BaseParagraphContentChecker, BaseParagraphFactory
+from pyams_content.features.renderer import RenderersVocabulary
from pyams_sequence.utility import get_reference_target
from pyams_utils.adapter import adapter_config
+from pyams_utils.factory import factory_config
from pyams_utils.registry import utility_config, get_utility
from pyams_utils.traversing import get_parent
+from pyams_utils.vocabulary import vocabulary_config
from zope.interface import implementer
from zope.schema.fieldproperty import FieldProperty
@@ -35,6 +39,7 @@
@implementer(IImageMapParagraph)
+@factory_config(provided=IImageMapParagraph)
class ImageMapParagraph(BaseParagraph):
"""Image map paragraph"""
@@ -42,6 +47,7 @@
icon_hint = _("Image map")
reference = FieldProperty(IImageMapParagraph['reference'])
+ renderer = FieldProperty(IImageMapParagraph['renderer'])
def get_target(self, state=None):
return get_reference_target(self.reference, state)
@@ -99,3 +105,10 @@
message=translate(_("image map '{0}' is not published")).format(
II18n(target).query_attribute('title', request=request))))
return output
+
+
+@vocabulary_config(name=IMAGEMAP_PARAGRAPH_RENDERERS)
+class ImageMapParagraphRendererVocabulary(RenderersVocabulary):
+ """Image map paragraph renderers vocabulary"""
+
+ content_interface = IImageMapParagraph