Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/320.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Alphabetically sort the list of portal types in the constraints configuration form @erral
7 changes: 6 additions & 1 deletion src/plone/app/content/browser/constraintypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
from z3c.form import button
from z3c.form import form
from z3c.form.browser.checkbox import CheckBoxFieldWidget
from zope.globalrequest import getRequest
from zope.i18n import translate
from zope.i18nmessageid import MessageFactory
from zope.interface import implementer
from zope.interface import Interface
Expand Down Expand Up @@ -50,10 +52,13 @@ def ST(key, title):
class ValidTypes:
def __call__(self, context):
constrain_aspect = context.context
request = getRequest()
items = []
for type_ in constrain_aspect.getDefaultAddableTypes():
items.append(SimpleTerm(value=type_.getId(), title=type_.Title()))
return SimpleVocabulary(items)
return SimpleVocabulary(
sorted(items, key=lambda x: translate(x.title, context=request).lower())
)


ValidTypesFactory = ValidTypes()
Expand Down