Skip to content

Commit

Permalink
Merge pull request #213 from plone/linkwidget-patternoptions
Browse files Browse the repository at this point in the history
Fix pattern options for `LinkWidget`
  • Loading branch information
1letter authored Nov 9, 2024
2 parents a5d2192 + c8d97de commit 3bf3c73
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions news/213.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix pattern options for `LinkWidget`.
[petschki]
3 changes: 3 additions & 0 deletions plone/app/z3cform/widgets/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3bf3c73

Please sign in to comment.