Skip to content

Commit

Permalink
Add mail_templates vocabulary.
Browse files Browse the repository at this point in the history
  • Loading branch information
robgietema committed Dec 17, 2024
1 parent feddf65 commit 477f020
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,9 @@
component=".vocabularies.captcha_providers_vocabulary_factory"
/>

<utility
name="collective.volto.formsupport.mail.templates"
component=".vocabularies.mail_templates_vocabulary_factory"
/>

</configure>
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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])

0 comments on commit 477f020

Please sign in to comment.