diff --git a/news/213.bugfix b/news/213.bugfix new file mode 100644 index 00000000..84e44c93 --- /dev/null +++ b/news/213.bugfix @@ -0,0 +1,2 @@ +Fix pattern options for `LinkWidget`. +[petschki] diff --git a/plone/app/z3cform/widgets/link.py b/plone/app/z3cform/widgets/link.py index 7af27b5f..6f9fbdf6 100644 --- a/plone/app/z3cform/widgets/link.py +++ b/plone/app/z3cform/widgets/link.py @@ -22,10 +22,13 @@ class LinkWidget(HTMLTextInputWidget, Widget): """ def pattern_data(self): + context = self.context or getSite() pattern_data = { "vocabularyUrl": "{}/@@getVocabulary?name=plone.app.vocabularies.Catalog".format( # noqa getSite().absolute_url(0), ), + "rootPath": "/".join(getSite().getPhysicalPath()), + "basePath": "/".join(context.getPhysicalPath()), "maximumSelectionSize": 1, } return json.dumps(pattern_data)