Admin API

Contents

This API provides admin-related functions.

Usage

Add the following to your build.gradle file:

dependencies {
  include "com.enonic.xp:lib-admin:${xpVersion}"
}

Add the import statement to your controller:

import adminLib from '/lib/xp/admin';

You are now ready to use the API.

Functions

getAssetsUri

Returns the admin assets uri.

Parameters

None

Returns

string : A URI pointing to the admin assets

getBaseUri

Returns the admin base uri.

Parameters

None

Returns

string : The admin base URI

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 server (server-relative URL) or absolute

Returns

string : The URL pointing to the Home Tool

getInstallation

Returns installation name.

Parameters

None

Returns

string : The installation name

getLauncherPath

Returns URL to JS script for embedding XP Launcher panel.

Parameters

None

Returns

string : URL of the Launcher JS script

getLauncherUrl

Returns URL of the Launcher panel.

Parameters

None

Returns

string : URL of the Launcher panel

getLocale

Returns the preferred locale based on current HTTP request, or the default server locale if none is specified.

Parameters

None

Returns

string : The preferred locale for this request

getLocales

Returns the list of preferred locales based on current HTTP request, or the default server locale if none is specified.

Parameters

None

Returns

string[] : Current locales in order of preference

getPhrases

Returns all i18n phrases.

Parameters

None

Returns

object : JSON object with phrases

getToolUrl

Returns URL of an admin tool in an 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 : URL of the requested admin tool.

getVersion

Returns version of XP installation.

Parameters

None

Returns

string : The version number of the XP runtime.


Contents

Contents

AI-powered search

Juke AI