Hi.
Is there a way to show specific images (attachments) based on the labels on a page?
It needs to be based on the labels on the specific page, NOT the images them selfs.
Anyone know of a way?
Hello @Mads Haugaard ,
As I know, this is NOT possible with platform macros, but this should be easy code to implement a custom macro or using a ScriptRunner script to get the list of such pages.
Example for a space pages with label 'TEST':
SpaceManager spaceManager = ComponentLocator.getComponent(SpaceManager.class);
Label label = new Label("TEST");
Space space = spaceManager.getSpace("SPACE_A");
List<Page> spacePages = space.getAllPages;
List<Attachment> attachments = new ArrayList<>();
spacePages.filter(page -> page.gtLabels().contains(label)).forEach(page -> {
List<Attachment> pageAttaches = page.getAtatchment();
attachments.addAll(pageAttaches);
});
return attachments;
Thanks
Thank you for the answer.
What I need is the som way to show images based on the labels on a page.
Ex.
A page has a label named "sunshine".
That page also has an attachment (image) named "sunshine.jpg" with the label "sunshine".
That image is automatically show on the above mentioned page.
If the label is removed from the page, then the image is no longer show.
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.