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 to achieve this? I'm using Plone5 and plone.app.mosaic.
Cool idea. We very much need a tile replacement for table of contents.
I think you mean persistent tiles can be got via annotations. Transient are the embedded ones.
I think you are right, the only way is to parse the page. Seems reasonable that mosaic should provide an api to iterate all the tiles on a page. I suspect the api would also have to parse the page too though. Actually I suspect the existing table of contents in plone must parse the page anyway.
The other way you could do it is as a transform layer. In fact you could probably do it using diazo since that has access to the rendered page but then its not inside a plugin and you can no longer theme a table of contents.
So I think perhaps a tile that registers a transform layer before diazo to collect all the headers on the page and insert a table of contents into a placeholder tile would work.
The advantage of this method is you don't have to know anything about the internals of any other tiles. As long as they render a heading it will work.