-
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Block transforms don't run for control panels #1868
Comments
@JeffersonBledsoe Er, what endpoint are you using to save and fetch the blocks? The transforms are done by a deserializer and serializer registered for the IBlocks behavior, so I wouldn't expect it to work outside the context of (de)serializing a content item with that behavior. We probably do need to generalize it somehow -- @sneridagh was also recently wanting to store blocks in a different field on content items. But which endpoints need to support it and how should they know which parts of the data structure contain blocks that need to be processed? |
@davisagli In this specific case I'm storing the blocks in the registry and using a custom widget to render the blocks form (multiple actually, but that's besides the point). A custom endpoint which essentially just returns this registry value is used outside of the control panel. I've made some notes while investigating this in the issue description. The control panel deserialisation code has a I agree it should be generalised so we can re-use the blocks in other ways more easily and appreciate it's hard problem to solve. |
NOTE
Need to do some more research, this might be a problem with my addon, will update as I go...
There doesn't seem to be an adapter for control panels, so if you try to use blocks in a control panel, the block transforms will never run, meaning we lose out on functionality like create a
resolveuid
link for links.Steps to reproduce
Expected result
The URL of the link has been changed to
resolveuid
Actual result
The URL stays as the absolute URL created from the
POST
request.Investigation
plone.restapi/src/plone/restapi/deserializer/controlpanels/__init__.py
Lines 55 to 57 in 259d969
iter_block_transform_handlers
doesn't return the handlers correctly in the subscribers request inplone.restapi/src/plone/restapi/blocks.py
Lines 42 to 57 in 259d969
FakeDXContext
) for a real object (e.g. withplone.api.portal.get()
or an unrestrictedTraverse to a page) the subscribers are correctly found and triggeredThe text was updated successfully, but these errors were encountered: