You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
after adding a RelatedItems field in dexterity content type control panel (TTW), if the object instance is inside a navigation root the widget is unable to work correctly. This is because when it is a field widget, RelatedItemsFieldWidget uses @@getSource to query the catalog and this view overwrite the path using plone.app.querystring.queryparser._navigationPath in a wrong way (basically it mess with the path) when the object is under a folder that is a navigation root. You can see it easily going to https://classic.demo.plone.org/en/, add a relationchoice field to the Document CT using the CT control panel, then edit a page and try to use it. You can choose only current folder items.
This behaviour is very hard to fix (no test to see how it should work) so, after reading the code and trying to understand how things works, I've found this solution:
In the xml model (you can edit TTW in the CT control panel -> the type -> model editor):
@adapter(schema.interfaces.IField, form.interfaces)@implementer(form.interfaces.IFieldWidget)defMyFieldWidgetFactory(field, request):
""" A special widget constructor setting up widget parameters for RelatedItemsField """widget=RelatedItemsFieldWidget(field, request)
widget.vocabulary_override=Truereturnwidget
Maybe there's an xml only solution, like a vocabulary_override tag inside form:widget and no type set.
The text was updated successfully, but these errors were encountered:
plone.app.z3cform/plone/app/z3cform/widgets/relateditems.py
Lines 191 to 197 in 3bf3c73
after adding a RelatedItems field in dexterity content type control panel (TTW), if the object instance is inside a navigation root the widget is unable to work correctly. This is because when it is a field widget,
RelatedItemsFieldWidget
uses@@getSource
to query the catalog and this view overwrite the path using plone.app.querystring.queryparser._navigationPath in a wrong way (basically it mess with the path) when the object is under a folder that is a navigation root. You can see it easily going to https://classic.demo.plone.org/en/, add a relationchoice field to the Document CT using the CT control panel, then edit a page and try to use it. You can choose only current folder items.This behaviour is very hard to fix (no test to see how it should work) so, after reading the code and trying to understand how things works, I've found this solution:
In the xml model (you can edit TTW in the CT control panel -> the type -> model editor):
and in
custom.py
:Maybe there's an xml only solution, like a
vocabulary_override
tag inside form:widget and no type set.The text was updated successfully, but these errors were encountered: