From 477f0202cbc8d6bf4e3f5c04efff069655a4b1be Mon Sep 17 00:00:00 2001 From: Rob Gietema Date: Tue, 17 Dec 2024 11:21:42 -0700 Subject: [PATCH] Add mail_templates vocabulary. --- .../collective/volto/formsupport/captcha/configure.zcml | 5 +++++ .../collective/volto/formsupport/captcha/vocabularies.py | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/backend/src/collective/volto/formsupport/captcha/configure.zcml b/backend/src/collective/volto/formsupport/captcha/configure.zcml index 194b1e2a..81202fe6 100644 --- a/backend/src/collective/volto/formsupport/captcha/configure.zcml +++ b/backend/src/collective/volto/formsupport/captcha/configure.zcml @@ -53,4 +53,9 @@ component=".vocabularies.captcha_providers_vocabulary_factory" /> + + diff --git a/backend/src/collective/volto/formsupport/captcha/vocabularies.py b/backend/src/collective/volto/formsupport/captcha/vocabularies.py index 8e91e53d..351484b6 100644 --- a/backend/src/collective/volto/formsupport/captcha/vocabularies.py +++ b/backend/src/collective/volto/formsupport/captcha/vocabularies.py @@ -1,4 +1,5 @@ from ..interfaces import ICaptchaSupport +from plone import api from zope.component import getAdapters from zope.interface import provider from zope.schema.interfaces import IVocabularyFactory @@ -13,3 +14,11 @@ def captcha_providers_vocabulary_factory(context): if adapter.isEnabled(): terms.append(SimpleTerm(value=name, token=name, title=adapter.name)) return SimpleVocabulary(terms) + + +@provider(IVocabularyFactory) +def mail_templates_vocabulary_factory(context): + name = "schemaform.mail_templates" + registry_record_value = api.portal.get_registry_record(name) + items = list(registry_record_value.keys()) + return SimpleVocabulary.fromItems([[item, item, item] for item in items])