From 18ba005c222782f5720f04c785f56dfb117e2baa Mon Sep 17 00:00:00 2001 From: Philip Bauer Date: Fri, 27 Sep 2024 09:13:56 +0200 Subject: [PATCH] fix issue with required choice-field without value by defining a default-value --- src/plone/app/standardtiles/existingcontent.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/plone/app/standardtiles/existingcontent.py b/src/plone/app/standardtiles/existingcontent.py index b6c6471..9d0ae0d 100644 --- a/src/plone/app/standardtiles/existingcontent.py +++ b/src/plone/app/standardtiles/existingcontent.py @@ -124,7 +124,7 @@ class IExistingContentTile(model.Schema): view_template = schema.Choice( title=_("Display mode"), - source=_("Available Content Views"), + source="Available Content Views", required=True, ) @@ -174,8 +174,10 @@ def content_view(self): def content_view_name(self): context = self.content_context if context is not None: - view_name = self.data.get("view_template") or context.getLayout() - return view_name + if self.data.get("view_template") == "default_layout": + return context.getLayout() + else: + return self.data.get("view_template") or context.getLayout() return "" _marker = dict() @@ -269,7 +271,9 @@ def availableContentViewsVocabulary(context): registry = getUtility(IRegistry) listing_views = registry.get("plone.app.standardtiles.content_views", {}) or {} - voc = [SimpleVocabulary.createTerm("", "", "Default view")] + voc = [ + SimpleVocabulary.createTerm("default_layout", "default_layout", "Default view") + ] for key, label in sorted(listing_views.items(), key=itemgetter(1)): voc.append(SimpleVocabulary.createTerm(key, key, label)) return SimpleVocabulary(voc)