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
Problem: We need to deliver the rendered Mosaic based content core area over a rest-api together with other information as JSON. (i.e. {'title': 'sometitle', 'content': 'somecontent', 'other': 123}
What we tried: Calling getMultiAdapter with name layout_view does not transform the output. So we need to transform this programmatically. Calling the transformchain (plone.transformchain.zpublisher.applyTransforms) seems not the right way - also we would need some fake request. Calling the transforms of plone.app.blocks.transforms.* one after each other does not feel right either.
Question: Whats the recommended way to render the tiles programmatically?
parse lxml tree with the contents of your content area wrapped into <html><body></body></html>.
pass the current request with tree to plone.app.blocks.tiles.renderTiles.
That will mutate the given lxml tree by expanding tiles in it. Tiles are expanded with the context of the request (by passing request to plone.subrequest).
This should work for all the use cases I can think of. The other transforms are to support panels and ESI. Mosaic also includes some extra transforms to support site layouts. In addition, I'm adding a one new transform into standardtiles to optimize rendering of default HTML tile (long story: originally there were not HTML tiles but HTML was baked into content layout, HTML tile was refactored into normal tile for Castle, the new transform would cook all HTML tiles in optimized fashion to only leave "real tiles" for rendedTiles transform).
Problem: We need to deliver the rendered Mosaic based content core area over a rest-api together with other information as JSON. (i.e. {'title': 'sometitle', 'content': 'somecontent', 'other': 123}
What we tried: Calling
getMultiAdapter
with namelayout_view
does not transform the output. So we need to transform this programmatically. Calling the transformchain (plone.transformchain.zpublisher.applyTransforms
) seems not the right way - also we would need some fake request. Calling the transforms ofplone.app.blocks.transforms.*
one after each other does not feel right either.Question: Whats the recommended way to render the tiles programmatically?
cc @datakurre
The text was updated successfully, but these errors were encountered: