I know this question, exists https://answers.atlassian.com/questions/48053/referencing-images-from-decorator-or-css-in-theme-plugin, and that works for use within my CSS and JS files.
But I want to include a custom icon for a Web-Item defined in atlassian-plugin xml.
The page that defines web-module uses an example that consumes an existing confluence provided icon, and is no help.
Current approach based on experience with JS/CSS use cases
<!-- icons --> <web-resource key="icons" name="confluence-scribbles Web Resources for edit"> <resource type="download" name="images/icons/" location="images/icons/"> <param name="content-type" value="image/gif" /> </resource> </web-resource> ... <!-- menu link to insert scribble while vieiwing page --> <web-item key="insert" name="Insert Scribble" section="system.content.add/page" weight="40"> <label key="scribbles.action.add" /> <link>/plugins/scribbles/scribbleedit.action</link> <icon height="16" width="16"> <link>../../download/resources/com.edwardawebb.confluence-scribbles:icons/images/icons/scribble_add_16.png</link> </icon> </web-item>
But to be honest, that seems cludgy and heavy weight for an internal refernce. I found this page, https://developer.atlassian.com/display/CONFDEV/Adding+Plugin+and+Module+Resources, which implies you can do it without the "web-resource" and expose specific items at a particular URL, but doesn;t show an example consuming any of those resources.
Preferred manner
<!-- icons --> <resource type="download" name="images/icons/" location="images/icons/"> <param name="content-type" value="image/gif" /> </resource> <!-- menu link to insert scribble while vieiwing page --> <web-item key="insert" name="Insert Scribble" section="system.content.add/page" weight="40"> <label key="scribbles.action.add" /> <link>/plugins/scribbles/scribbleedit.action</link> <icon height="16" width="16"> <link>CLEANER-URL_HERE</link> </icon> </web-item>
Community moderators have prevented the ability to post new answers.
Hi!
It's possible to add an icon via the resource module. Use the name attribute as part of the icon path, e.g:
<resource type="download" name="icons/" location="icons/" /> <web-item key="insert" name="Insert Scribble" section="system.content.add/page" weight="40"> <label key="scribbles.action.add" /> <link>/plugins/scribbles/scribbleedit.action</link> <icon height="16" width="16"> <link>/download/resources/PLUGINKEY/icons/star_yellow.gif</link> </icon> </web-item>
Hope this helps!
This is the correct way to do it. The <resource> element in atlassian-plugin.xml can actually be attached as a child of any plugin module, or it can be a root element as in this example - it is most commonly used with a web-resource module because then you get the benefits of the web resource framework, like batching, minifcation, dependency ordering and the like.
It's still not quite as "clean" as Eddie would probably like, but sadly, there's no "shortcut" way for a module definition to refer to the URL of a resource in another module (or even within the same module) - you always have to use the fully-qualified form.
If you're super concerned about how messy it is, you might like to try and introduce a pre-compilation step to your atlassian-plugin.xml to tidy things up - for example you could use Maven resource filtering to hide the 'messy' details of the URL away somewhere and refer to it using some other variable.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
indeed, i was hoping for something more like you would find where the pluginIcon and pluginLogo are defined. But this will ahve to do! thanks guys
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.