Skip to content

Commit

Permalink
Fix not getting global form if context ends up being a page
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffersonBledsoe committed Feb 5, 2025
1 parent 351a43c commit 29d389b
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/collective/volto/formsupport/adapters/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,22 @@ def extract_data_from_request(self):

def get_block_data(self, block_id, global_form_id):
blocks = get_blocks(self.context)
global_form_id = global_form_id
if global_form_id:
global_forms = api.portal.get_registry_record(
GLOBAL_FORM_REGISTRY_RECORD_ID
)
if global_forms:
blocks = {**blocks, **global_forms}
if not blocks:
global_form_id = global_form_id
if global_form_id:
global_forms = api.portal.get_registry_record(
GLOBAL_FORM_REGISTRY_RECORD_ID
)
if global_forms:
blocks = global_forms
else:
return {}
else:
return {}
return {}
for id, block in blocks.items():
# Prefer local forms it they're available, fall back to global form
if id != block_id and id != global_form_id and block.get("global_form_id") != global_form_id:
if (
id != block_id
and id != global_form_id
and block.get("global_form_id") != global_form_id
):
continue
block_type = block.get("@type", "")
if block_type != "form":
Expand Down

0 comments on commit 29d389b

Please sign in to comment.