Admin Library
Contents
This library contains admin related functions.
Usage
Add the following to your build.gradle
file:
dependencies {
include "com.enonic.xp:lib-admin:${xpVersion}"
}
In your JavaScript controller, add a require statement:
const adminLib = require('/lib/xp/admin');
You are now ready to use the library functionality.
Functions
getAssetsUri
Returns the admin assets uri.
Parameters
None
Returns
string : A URI pointing to the admin assets
getHomeToolUrl
Returns the URL for the Home admin tool.
Parameters
An object with the following keys and their values:
Name | Kind | Details |
---|---|---|
type |
string |
Either |
Returns
string : The URL pointing to the Home Tool
getLauncherPath
Returns the URL for launcher javascript.
Parameters
None
Returns
string : The URL for the launcher javascript
getLauncherUrl
Returns the URL for the launcher panel.
Parameters
None
Returns
string : The URL for the launcher panel
getLocale
Returns the preferred locale based on the current HTTP request, or the server default locale if none is specified.
Parameters
None
Returns
string : The preferred locale for this request
getLocales
Returns the list of preferred locales based on the current HTTP request, or the server default locale if none is specified.
Parameters
None
Returns
string[] : Current locales in order of preference
getToolUrl
Returns the URL for an admin tool of specific application.
Parameters
Name | Kind | Details |
---|---|---|
application |
string |
Full application name (f.ex, 'com.enonic.app') |
tool |
string |
Name of the tool inside an app (f.ex, 'main') |
Returns
string : The URL to the requested tool.
getVersion
Returns version of XP installation.
Parameters
None
Returns
string : The version number of the XP runtime.