--- a/src/pyams_content/component/links/interfaces.py Wed Sep 25 09:47:48 2019 +0200
+++ b/src/pyams_content/component/links/interfaces.py Wed Sep 25 09:50:05 2019 +0200
@@ -10,21 +10,18 @@
# FOR A PARTICULAR PURPOSE.
#
-__docformat__ = 'restructuredtext'
+from zope.interface import Attribute, Interface
+from zope.schema import Bool, Choice, InterfaceField, TextLine, URI
+
+from pyams_content.component.association.interfaces import IAssociationContainerTarget, \
+ IAssociationItem
+from pyams_content.reference.pictograms.interfaces import SELECTED_PICTOGRAM_VOCABULARY
+from pyams_i18n.schema import I18nTextField, I18nTextLineField
+from pyams_sequence.interfaces import IInternalReference
+from pyams_utils.schema import MailAddressField
-# import standard library
-
-# import interfaces
-from pyams_content.component.association.interfaces import IAssociationContainerTarget, IAssociationItem
-from pyams_content.reference.pictograms.interfaces import SELECTED_PICTOGRAM_VOCABULARY
-from pyams_sequence.interfaces import IInternalReference
-
-# import packages
-from pyams_i18n.schema import I18nTextLineField, I18nTextField
-from pyams_utils.schema import MailAddressField
-from zope.interface import Attribute
-from zope.schema import Choice, TextLine, URI, Bool
+__docformat__ = 'restructuredtext'
from pyams_content import _
@@ -37,7 +34,8 @@
required=False)
description = I18nTextField(title=_("Description"),
- description=_("Link description displayed by front-office template"),
+ description=_(
+ "Link description displayed by front-office template"),
required=False)
pictogram_name = Choice(title=_("Pictogram"),
@@ -55,13 +53,45 @@
"""Internal link interface"""
force_canonical_url = Bool(title=_("Force canonical URL?"),
- description=_("By default, internal links use a \"relative\" URL, which tries to "
- "display link target in the current context; by using a canonical URL, "
- "you can display target in it's attachment context (if defined)"),
+ description=_("By default, internal links use a \"relative\" URL, "
+ "which tries to display link target in the current "
+ "context; by using a canonical URL, you can display "
+ "target in it's attachment context (if defined)"),
required=False,
default=False)
+#
+# Custom internal link properties support
+# These interfaces are used to be able to add custom properties to an internal link
+# when it's target is of a given content type
+#
+
+class IInternalLinkCustomInfoTarget(Interface):
+ """Internal link target info
+
+ This optional interface can be supported be any content to be able to provide any
+ additional information to link properties
+ """
+
+ internal_link_marker_interface = InterfaceField(title=_("Marker interface provided by links "
+ "directed to contents supporting this "
+ "interface"))
+
+
+class ICustomInternalLinkTarget(Interface):
+ """Base interface for custom internal link target"""
+
+
+class IInternalLinkCustomInfo(Interface):
+ """Base interface for custom link properties"""
+
+ properties_interface = InterfaceField(title=_("Info properties interface"))
+
+ def get_url_params(self):
+ """Get custom params to generate link URL"""
+
+
class IExternalLink(IBaseLink):
"""External link interface"""