There is a Plone control panel to configure Mosaic called Mosaic Layout Editor.
Just add @@layouts-editor to your sites URL.
Restricting content layouts globally¶
To hide layouts globally...
a) Programmatically (while developing your product)¶
- Add it to the hidden_content_layouts list in the registry
- by configuring this in registry.xml:
<record name="plone.app.mosaic.hidden_content_layouts"> <value purge="False"> <element>default/news_item.html</element> </value> </record>
Go to the Mosaic settings in the sites control panel (see above) and choose the tab Show/Hide Content Layouts.
There you can toggle the visibility of your content layouts.
Restricting content layouts per content type¶
You can restrict the choice of content layouts for each of the available content types by adding a manifest.cfg to your/product/layouts/.
The following example was taken from src/plone/app/mosaic/layouts/content/
[contentlayout] title = Basic description = Default content layout file = basic.html preview = basic.png [contentlayout] title = Document file = document.html for = Document preview = document.png [contentlayout] title = News item layout description = Default news item layout file = news_item.html for = News Item preview = news_item.png
There are three content layouts defined here.
- title, description, preview
- The title and (optionally) description strings together with a prepared “thumbnail” preview of the respective layout will be shown to users when selecting one of the content layouts for some content item.
- The for setting limits for which Plone content types the content layouts may be selected. This may be a comma-separated list of content types.
- The file setting determines which html file with a given layout is chosen.
So for each content layout you should provide
- a html file containing the actual layout
- a png file with a small preview
- a stanza in manifest.cfg
You can also hide a layout for one type in registry.xml
<record name="plone.app.mosaic.hidden_content_layouts"> <value purge="False"> <element>default/news_item.html::News Item</element> </value> </record>
This will hide layout default/news_item for News Item.
There are permissions that control who can create and change content layouts - for current user and globally.
- Plone: Manage Content Layouts (plone.ManageContentLayouts)
- protects layout -> “change” button in editor
- Plone: Customize Content Layouts (plone.CustomizeContentLayouts)
- controls if user can customize and save the customized layout
- protects layout -> “customize” button in editor
- by default this is Manager, Site Administrator, Owner, Editor
- plone.resourceeditor: Manage Sources (plone.resourceeditor.ManageSources)
- protects layout editor in control panel
- Plone: Manage Site Layouts (plone.ManageSiteLayouts)
- will protect changing site layouts once they are enabled
For default groups see rolemap.xml in plone.app.blocks.
Restricting who can change (chose another) content layouts¶
Any user who can edit, can change layout on content they have access to edit.
Restricting who can customize/save new layouts through UI¶
plone.CustomizeContentLayouts is needed on context to save a user layout. Owner, Editor and Manager have that permission.
To save the customized layout globally you need plone.ManageContentLayouts on site in addition. Manager has that permission per default.
Restricting who can delete content layouts¶
To delete your own layout you need plone.CustomizeContentLayouts on context. To delete a global content layout you need plone.ManageContentLayouts on site in addition (Manager can do this).
Moving and Editing tiles¶
Example tile with all functionality to move, remove, edit, etc::¶
<div class="movable removable mosaic-tile mosaic-IDublinCore-description-tile"> <div class="mosaic-tile-content"> <div data-tile="./@@plone.app.standardtiles.field?field=IDublinCore-description"></div> </div> </div>
Adding unmovable tiles into content layouts¶
If you want to have tiles in your layout that editors cannot move around to other places in the current content layout through the Mosaic Editor, you can remove movable from the classes definition in the Content Layouts Editor.
Example tile definition in layout
<div class="removable mosaic-tile mosaic-IDublinCore-description-tile"> <div class="mosaic-tile-content"> <div data-tile="./@@plone.app.standardtiles.field?field=IDublinCore-description"></div> </div> </div>
Adding non-removable tiles into content layouts (removing class ‘removable’ from ‘mosaic-tile’)¶
<div class="movable mosaic-tile mosaic-IDublinCore-description-tile"> <div class="mosaic-tile-content"> <div data-tile="./@@plone.app.standardtiles.field?field=IDublinCore-description"></div> </div> </div>
Adding readonly tiles into content layouts¶
Add class ‘mosaic-read-only-tile’ into ‘mosaic-tile’
<div class="movable removable mosaic-read-only-tile mosaic-tile mosaic-IDublinCore-description-tile"> <div class="mosaic-tile-content"> <div data-tile="./@@plone.app.standardtiles.field?field=IDublinCore-description"></div> </div> </div>
Configuring the amount of columns available in layout¶
The default value for the amount of columns is set to 4. It can optionally configured to a different value using the attribute data-max-columns in the layout file. This attribute needs to be set on the div element that has the attribute data-panel=”content”
Adding editable HTML area (raw html tile) into content layout¶
plone_app_standardtiles_html (in registry.xml) is hidden - change to structure to save html of tile at content and not in layout
see plone.app.mosaic registry.xml. this can go into your policy product. tinyMCE features need to be added/activated for each tile
- Hiding a tile from insert menu
- Moving a tile in insert menu
- Adding a new HTML template tile into insert menu
- Adding a new custom (Python based) tile into insert menu
- Adding a new action into TinyMCE editor #200
- Hiding tile formats from format menu
- Adding a new tile format into format menu
- Hiding row formats from format menu
- Adding a new row format into format menu