How to add new Display Mode to Mosaic Existing Content Tile

I have previously added items to the Display Mode option for the Content Listing Mosaic tile, now I am trying to add an item to the Display Mode for the Existing Content Mosaic tile but the process appears to be different and has stumped me.

I registered the template:

  <browser:page
      for="*"
      permission="zope2.View"
      name="linked_title_view"
      template="templates/existingcontent_linkedtitle_view.pt"
      />

With Content Listing, there was a layer attribute, but there was no layer interface defined in plone.app.standardtiles.existingcontent.py. Leaving off the layer attribute allowed the view to be found.

I also added the view to the registry in my mosaic.xml file:

  <record name="plone.app.standardtiles.content_views">
    <field type="plone.registry.field.Dict">
      <title>Content Views</title>
      <key_type type="plone.registry.field.TextLine" />
      <value_type type="plone.registry.field.TextLine" />
    </field>
    <value purge="true">
      <element key="linked_title_view">Linked title view</element>
    </value>
  </record>

This all resulted in my new "Linked title view" option appearing when configuring the tile but when I select it, it still renders the same way without using my custom template.

I have inspected the code in plone.app.standardtiles.existingcontent.py, particularly the ExistingContentTile.content_view method and it returns a SimpleViewClass instance that references my template but again, nothing in my template is rendered.

What am I missing to make this work?

Hi!

I always wanted existing content tile template to work like contentlisting tile template... unfortunately it does not :wink:

The selector for the display modes is a configuration registry entry called plone.app.standardtiles.content_views (see https://github.com/plone/plone.app.standardtiles/blob/main/src/plone/app/standardtiles/existingcontent.py#L271) ... so far so good.

The template for existingcontenttile now tries to lookup the macro content-core inside this registered template (https://github.com/plone/plone.app.standardtiles/blob/main/src/plone/app/standardtiles/templates/existingcontent_view.pt#L12) and places it below title/description/image. If not found, its empty without any hint.

This is a bit quirky because if you want to change title/description/image position inside your template with content-core macro, you always have to uncheck the checkboxes in the schema in order to not show them twice.