# HG changeset patch # User Thierry Florac # Date 1539681417 -7200 # Node ID f543e56f0d07784706fcc507e1205839c2878ea8 # Parent f419b942f7f4c7f9ce1bf70e1c2a5c65b2e58838 Added content link illustration adapter diff -r f419b942f7f4 -r f543e56f0d07 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)