Closed mauritsvanrees closed 7 months ago
@mauritsvanrees with "you do not get the normal content edit screen" you mean the modal where you can select one of the available content layouts? (by default 2 layouts, title+description, or title, description,richtext).
I can imagine that if you create a new contenttype where you want to have a predefined layout, that it should be possible to couple contenttype to layout and skip the layout selection modal?
plone.volto has a similar feature where you can define an existing block layout and connect it to content type as the default 'pre filled' layout using the contenttype control panel.
On the add-form I want to have the normal content edit screen that you get in a standard Classic Plone site without Mosaic, so you can set all the fields: title, description, dates, tags, etc.
What I get, is the layout view:
If the layout view could be fixed so it also works on an add-form, so that clicking the Save button actually creates the content item and the tiles, that would be fine too. No idea if this is a five minute fix or a five day fix. :-)
I get the idea ... two thoughts about this:
Mosaic has a condition for AddForm view here https://github.com/plone/plone.app.mosaic/blob/master/src/plone/app/mosaic/browser/main_template.py#L242 maybe you can override this MainTemplateBrowserView
with your addon browserlayer and do some logic there to disable pattern initialization.
Mosaic gets enabled on the https://github.com/plone/plone.app.blocks/blob/master/plone/app/blocks/layoutbehavior.py customContentLayout
field (https://github.com/plone/plone.app.mosaic/blob/master/src/plone/app/mosaic/widget.py#L218) , so if this field is missing on the add-form this should do the trick too ...
I don't know if I faced the same problem but with plone.app.mosaic = 3.0.3
and Plone = 6.0.2
for my custom contenttype with this two behaviors:
plone.layoutaware
plone.draftable
When adding my contenttype, in ++add++MyCT the mosaic view was enabled by default so I could not specify a title and descripion.
Debuging a little I found out that the custom AddForm of mosaic was not being executed. I think this was a layer order problem. In some cases it was working in others not depending in which order I installed some products:
plone.app.mosaic
plone.app.multilingual
my.product
I ended up making my custom product layer inherit from from plone.app.z3cform.interfaces import IPloneFormLayer
from plone.app.z3cform.interfaces import IPloneFormLayer
class IMyProductLayer(
[... other interfaces ...]
IPloneFormLayer,
):
Checking multilingual it also inherits from IPloneFormLayer
so I guess that's why sometimes it was working when installing multilingual in some order
https://github.com/plone/plone.app.multilingual/blob/2e51c99d56c1fb15ce382afea97070230471a37a/src/plone/app/multilingual/interfaces.py#L161
Maybe mosaic should do the same? I have not tested
I have tried the suggestions, but I could not get them to work for my use case. I will keep it to the patch I had already in collective.mosaicpage
.
I have created
collective.mosaicpage
. This adds a portal_type that haslayout_view
as default_view and as only allowed view. In a standard Plone site with Mosaic you can achieve almost the same by editing the Document type to only havelayout_view
.Problem: when adding such a page, you do not get the normal content edit screen so you can set a title and description, but you get the Mosaic layout editor: choose a layout, add tiles. Here the Save and Cancel buttons do not work.
In https://github.com/collective/collective.mosaicpage/pull/2, specifically this commit, I patch the layout view to not be enabled on the add-form. I would like to make a PR to do this in Mosaic itself, in
widget.py
.Before I do that, I wonder: is there ever a situation where we want to immediately see the layout view when adding a content item?