fredvd
(Fred van Dijk)
November 10, 2020, 10:14am
1
I need to update a field values in several (custom) persistent tiles in a Plone 5.2 website. I have searched for some convenience methods to get a list of tiles both in the tiles code and online, but it seems to me this was never implemented. Others asking for this:
Hi all
I'm looking to create a "table of contents" style navigation for all of the tiles on mosaic page that has a "title" field.
The only way to find all of the tiles on the page seems to be to use xpath to generate these, getting the configuration would be a task of its own then. Getting a list of transient tiles is easy as I can simply inspect self.context.annotations_ and list the data from there, but the tiles embedded using encoding is a bit harder.
Does anyone have any convenient way …
opened 10:09AM - 23 Jan 18 UTC
04 type: enhancement
05 type: question
Hello there,
sometimes it would help me to just iterate over all Mosic tiles … (preferably of a certain type) but I didn't find any way to query them.
(to be clear: I know that there are dictionaries like "plone.app.tiles.RegisteredTiles". But AFAIK they only refer to the TYPES of tiles. Not the actual tile instances)
If I overlooked something in the documentation I deeply sorry.
If I didn't, please consider this a feature request ;)
@pbauer wrote an informative post on content/site layouts but this dives deep into the layouts itself and programmatically setting these: How do I configure a mosaic layout programmatically?
I have done something similar in the past with collective.cover. It has a get_tiles method, but it depends on an another internal storage for the tile layout (collective.cover/src/collective/cover/content.py at df833bc0278edb991c919accbc522692b5ef0c69 · collective/collective.cover · GitHub )
So it seems I have to traverse all content types allowing the mosaic layout view, request the content layout, parse the html for tiles and their tile types and use the detected ID's to request the annotation for the tile on the context?
espenmn
(Espen)
November 10, 2020, 12:59pm
2
This is not a solution, but a hack:
If it is 'about all of the tiles of a certain type'.
It might be possible to add
def set_the_value(self)
do some calculations
self.data['the_field] = 'calculated stuff'
and (really lazy) : ${view/set_the_value} in the tile template.
Then open/view all mosaic pages and remove the code when you are done.