Okay, by looking the registry.xml plone.app.standardtiles posted by @jensens, I could find my error on it, I need to wrap everything around <?xml version="1.0"?><registry></registry>
, so now I made wrote a profile/default/registry.xml
on my theme like this:
<?xml version="1.0"?>
<records prefix="plone.app.mosaic.app_tiles.news_card" interface="plone.app.mosaic.interfaces.ITile">
<value key="name">tiles.newscard</value>
<value key="label">News Card</value>
<value key="category">advanced</value>
<value key="tile_type">app</value>
<value key="default_value"></value>
<value key="read_only">false</value>
<value key="settings">true</value>
<value key="favorite">false</value>
<value key="rich_text">false</value>
<value key="weight">40</value>
</records>
<record name="plone.app.standardtiles.listing_views">
<field type="plone.registry.field.Dict">
<title>Listing Views</title>
<key_type type="plone.registry.field.TextLine" />
<value_type type="plone.registry.field.TextLine" />
</field>
<value purge="false">
<element key="listing_view">Listing view</element>
<element key="summary_view">Summary view</element>
<element key="tabular_view">Tabular view 2</element>
</value>
</record>
So I can see now under the advanced category of Mosaic my News card tile and I can also see that I could change a display mode name for a 'Existing content' tile.
I could now the news card
and I can select a news:
But I have to debug the error that is appearing in the browser console:
Uncaught TypeError: can't access property 0, /<body[^>]>[^]</body>/im.exec(...) is null
parseBodyTag plone-compiled.js:502
redraw plone-compiled.js:5766
success plone-compiled.js:5173
success plone-compiled.js:3594
jQuery 6
b plone-compiled.js:3753
ajaxSubmit plone-compiled.js:3650
handleFormAction plone-compiled.js:5116
form plone-compiled.js:5066
dispatch jQuery
dispatch plone-logged-in-compiled.js:8311
jQuery 6
render plone-compiled.js:5322
dispatch jQuery
dispatch plone-logged-in-compiled.js:8311
jQuery 7
render plone-compiled.js:5319
jQuery 2
render plone-compiled.js:5310
render plone-compiled.js:5653
_show plone-compiled.js:5720
createHtmlModal plone-compiled.js:5494
show plone-compiled.js:5660
r plone-mosaic.js:3
success plone-mosaic.js:3
jQuery 6
exec plone-mosaic.js:3
mosaicExecAction plone-mosaic.js:3
jQuery 2
mosaicExecAction plone-mosaic.js:3
a plone-mosaic.js:2
dispatch jQuery
dispatch plone-logged-in-compiled.js:8311
jQuery 6
triggerChange plone-editor-tools-compiled.js:2211
onSelect plone-editor-tools-compiled.js:3529
selectHighlighted plone-editor-tools-compiled.js:2941
init plone-editor-tools-compiled.js:1699
bind plone-editor-tools-compiled.js:1573
dispatch jQuery
dispatch plone-logged-in-compiled.js:8311
handle jQuery
plone-compiled.js:502:43
Source map error: Error: request failed with status 404
Resource URL: http://localhost:8080/Plone/++plone++mosaic/++unique++2021-11-29%2017%3A08%3A57.878780/plone-mosaic.js
Source Map URL: plone-mosaic.js.map
I will come back to work on this later, but I already appreciate the feedback from all @jensens @mtrebron @espenmn.
I know how to create a view (following this), but I would need to see how to add it to this list of views pointed out by @jensens we can find here: plone.app.standardtiles/plone/app/standardtiles/contentlisting.py at 2ba83af92052eb3a3c28d8a4df071c4dfbc25cab · plone/plone.app.standardtiles · GitHub
Just to complement, I've added the following on my browser/configure.zcml
:
<include package="plone.app.mosaic" />
<plone:tile
name="tiles.newscard"
title="Custom News Card"
description="A tile which displays a news"
add_permission="cmf.ModifyPortalContent"
class=".tiles.NewsCardTile"
for="*"
permission="zope.Public"
schema=".tiles.INewsCardTile"
template="templates/news_tile.pt"
/>
And this is my broswer/tile.py
just for testing
from plone.app.vocabularies.catalog import CatalogSource
from plone.supermodel import model
from zope import schema
class INewsCardTile(model.Schema):
content_uid = schema.Choice(
title=u"Select a news item object",
required=True,
source=CatalogSource(portal_type=['News Item',]),
)
from plone.app.standardtiles.existingcontent import ExistingContentTile
class NewsCardTile(ExistingContentTile):
""" A tile for mosaic representing a news card """
My template prints just a <h1>Hellow world</h1>
.