Skip to content

Commit

Permalink
Merge pull request #173 from plone/172-preview-image-anywhere
Browse files Browse the repository at this point in the history
allow choosing preview images from a different language tree
  • Loading branch information
sneridagh authored and davisagli committed Dec 17, 2024
1 parent 63715cc commit 4a7593b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/172.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow setting `preview_image_link` to an image from a different language root folder. @davisagli
12 changes: 11 additions & 1 deletion src/plone/volto/behaviors/preview_link.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@
from zope.schema import TextLine


# Allow choosing preview images from a different language tree in a multi-lingual site.
# See https://github.com/plone/plone.volto/issues/172
try:
import plone.app.multilingual # noqa

VOCAB = "plone.app.multilingual.RootCatalog"
except ImportError:
VOCAB = "plone.app.vocabularies.Catalog"


@provider(IFormFieldProvider)
class IPreviewLink(model.Schema):

Expand All @@ -26,7 +36,7 @@ class IPreviewLink(model.Schema):
"help_previewimage",
default="Select an image that will be used in listing and teaser blocks.",
),
vocabulary="plone.app.vocabularies.Catalog",
vocabulary=VOCAB,
required=False,
)

Expand Down

0 comments on commit 4a7593b

Please sign in to comment.