Hi devs,
I'm making a rest resource to get a list of pages and, for a query, I
want to specify an icon (as a metadata) for each pages in the resulted
json.
The problem is that the icon APIs (and more specifically the
IconManager class) only allow us to render the icon in HTML or
velocity and this shouldn't be put inside a json response.
Also we can't hardcode the icon class or image URL to be used as it
depends on the iconset configured for the wiki. Another possibility
would be to render the icon using javascript but it will not be very
efficient.
As discussed with Marius, our proposal would be to add a new method to
the IconManager to get either the icon URL (e.g.
http://xwiki.org/xwiki/resources/icons/silk/page.png) or the icon
class (e.g. fa fa-page) depending of the specified iconset.
We could then have this new property to the icon theme definition:
## Silk
xwiki.iconset.render.json=$xwiki.getSkinFile("icons/silk/${icon}.png")
## FontAwesome
xwiki.iconset.render.json=fa fa-$icon
We could name the new method renderJSON or something more generic (if
you have any idea).
WDYT?
Thanks,
Adel