Description

The main entry point of this module is the org.xwiki.skin.SkinManager component.

Each skin is represented by org.xwiki.skin.Skin interface which is in most part a org.xwiki.skin.ResourceRepository. As its name indicated it provide APIs to navigate in the resource located in the skin, it's also take into account skin inheritance when searching a resource.

See the module javadoc for more details.

Java examples

get the skin with id "xwiki:Main.MySkin":

importorg.xwiki.skin.SkinManager;importorg.xwiki.skin.Skin;

...

@InjectSkinManager skinManager;

...

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

get the current skin:

importorg.xwiki.skin.SkinManager;importorg.xwiki.skin.Skin;

...

@InjectSkinManager skinManager;

...

// We don't care if the current user have the right to access the current skin so we put falseSkin currentSkin = skinManager.getCurrentSkin(false);

// We want the first skin that works for current userSkin currentSkin = skinManager.getCurrentSkin(true);

// The resource is the skin or one of its parentsResource myresource = currentSkin.getResource("myscript.js")// Print the skin where the resource was foundSystem.out.println(myresource.getRepository());