Skin Module

The Skin module provides the tools and API to access skin resources. 

The SkinManager component is the main entry point of the module and each skin is represented by a Skin interface which is mostly a ResourceRepository. This interface provides the API for navigating to the resources located in the skin and most importantly, it takes into account the skin inheritance.

Examples

1. Retrieve the skin having the ID "xwiki:Main.MySkin".

import org.xwiki.skin.SkinManager;
import org.xwiki.skin.Skin;

@Inject
SkinManager skinManager;

Skin myWikiSkin = skinManager.getSkin("xwiki:Main.MySkin");

2. Retrieve the current skin.

import org.xwiki.skin.SkinManager;
import org.xwiki.skin.Skin;

@Inject
SkinManager skinManager;

// Since it is not important whether the current user has the right to access the current skin,
//the parameter is set to false
Skin currentSkin = skinManager.getCurrentSkin(false);

3. Recursively search the resource "myscript.js" in the current skin.

import org.xwiki.skin.SkinManager;
import org.xwiki.skin.Skin;
import org.xwiki.skin.Resource;

@Inject
SkinManager skinManager;

// Retrieve the first skin on which the current user has access rights
Skin currentSkin = skinManager.getCurrentSkin(true);

// Check whether the resource is the skin or one of its parents
Resource myresource = currentSkin.getResource("myscript.js")

// Print the skin where the resource was found
System.out.println(myresource.getRepository());

// The resource is the skin itself only
Resource myskinresource = currentSkin.getLocalResource("myscript.js")

   

Related Pages

Search this space

 

Most popular tags

Failed to execute the [groovy] macro
  1. access rights
  2. activity stream
  3. annotation
  4. attachment
  5. comment
  6. Document Tree Macro
  7. export
  8. Extension Manager
  9. Flamingo skin
  10. global user
  11. Groovy event listener
  12. group
  13. nested page
  14. search
  15. skin
  16. syntax
  17. user
  18. user profile
  19. velocity macros
  20. wiki
  21. wysiwyg
  22. XWiki Applications
  23. xwikiattachment_archive table
  24. xwikiattachment table
  25. xwikiattrecyclebin table
  26. xwikiproperties table

[Display all tags from this space]