Table of Contents

Class SxcGlobalCms

Global Content-Management System on the $2sxc.cms. It is only available if the page is in edit mode / the page feature 2sxc.JsCms has been activated.

The $2sxc.cms API

you are here (click to zoom) - discover the stack

The $2sxc.cms object is the core JavaScript API to perform CMS actions such as opening edit-dialogs etc. As of now (v9.30 - v13) it only has 1 command run(...) but will be enhanced in the future to do more.

You need this in advanced use cases. otherwise you don't need this. Such advanced cases are:

  1. when you create custom JS buttons to start a content-management action

How to use v12.10 and newer

2sxc 12.10 enhanced the cms.run(params: RunParamsWithContext) to accept an object with parameters. This makes it easier to reliably pass in optional parameters, and also supports the use of Workflow Steps.

👉 Learn more in the Cms-Run Docs.

Package: Api.Js.SxcJs

Methods

run(HTMLElement, CommandParams, MouseEvent)

Run a command within a specific context.

The $2sxc.cms API

you are here (click to zoom) - discover the stack

The $2sxc.cms object is the core JavaScript API to perform CMS actions such as opening edit-dialogs etc. As of now (v9.30 - v13) it only has 1 command run(...) but will be enhanced in the future to do more.

You need this in advanced use cases. otherwise you don't need this. Such advanced cases are:

  1. when you create custom JS buttons to start a content-management action

How to use v12.10 and newer

2sxc 12.10 enhanced the cms.run(params: RunParamsWithContext) to accept an object with parameters. This makes it easier to reliably pass in optional parameters, and also supports the use of Workflow Steps.

👉 Learn more in the Cms-Run Docs.

Declaration
function run<T>(tag: HTMLElement, commandParams: CommandParams, event?: MouseEvent)
Parameters
Type Name Description
HTMLElement tag

The context providing tag - an HTML tag inside a module/content-block

CommandParams commandParams

an object containing the the command-params as well as the command-name (action)

MouseEvent event

Optional mouse-event which allows the command to do some optimizations for that case - like a mouse-click

Returns
Type Description
Promise<void | T>

A promise which triggers when the command has completed.

run(HTMLElement, string, CommandParams, MouseEvent)

Run a command within a specific context.

The $2sxc.cms API

you are here (click to zoom) - discover the stack

The $2sxc.cms object is the core JavaScript API to perform CMS actions such as opening edit-dialogs etc. As of now (v9.30 - v13) it only has 1 command run(...) but will be enhanced in the future to do more.

You need this in advanced use cases. otherwise you don't need this. Such advanced cases are:

  1. when you create custom JS buttons to start a content-management action

How to use v12.10 and newer

2sxc 12.10 enhanced the cms.run(params: RunParamsWithContext) to accept an object with parameters. This makes it easier to reliably pass in optional parameters, and also supports the use of Workflow Steps.

👉 Learn more in the Cms-Run Docs.

Declaration
function run<T>(tag: HTMLElement, action: string, params?: CommandParams, event?: MouseEvent)
Parameters
Type Name Description
HTMLElement tag

The context providing tag - an HTML tag inside a module/content-block

string action

command-name (action)

CommandParams params

an object containing the the command-params

MouseEvent event

Optional mouse-event which allows the command to do some optimizations for that case - like a mouse-click

Returns
Type Description
Promise<void | T>

A promise which triggers when the command has completed.

run(HTMLElement, string, MouseEvent)

Run a command within a specific context.

The $2sxc.cms API

you are here (click to zoom) - discover the stack

The $2sxc.cms object is the core JavaScript API to perform CMS actions such as opening edit-dialogs etc. As of now (v9.30 - v13) it only has 1 command run(...) but will be enhanced in the future to do more.

You need this in advanced use cases. otherwise you don't need this. Such advanced cases are:

  1. when you create custom JS buttons to start a content-management action

How to use v12.10 and newer

2sxc 12.10 enhanced the cms.run(params: RunParamsWithContext) to accept an object with parameters. This makes it easier to reliably pass in optional parameters, and also supports the use of Workflow Steps.

👉 Learn more in the Cms-Run Docs.

Declaration
function run<T>(tag: HTMLElement, action: string, event?: MouseEvent)
Parameters
Type Name Description
HTMLElement tag

The context providing tag - an HTML tag inside a module/content-block

string action

command-name (action)

MouseEvent event

Optional mouse-event which allows the command to do some optimizations for that case - like a mouse-click

Returns
Type Description
Promise<void | T>

A promise which triggers when the command has completed.

run(RunParamsWithContext)

Run a command within a specific context - mostly for internal use.

The $2sxc.cms API

you are here (click to zoom) - discover the stack

The $2sxc.cms object is the core JavaScript API to perform CMS actions such as opening edit-dialogs etc. As of now (v9.30 - v13) it only has 1 command run(...) but will be enhanced in the future to do more.

You need this in advanced use cases. otherwise you don't need this. Such advanced cases are:

  1. when you create custom JS buttons to start a content-management action

How to use v12.10 and newer

2sxc 12.10 enhanced the cms.run(params: RunParamsWithContext) to accept an object with parameters. This makes it easier to reliably pass in optional parameters, and also supports the use of Workflow Steps.

👉 Learn more in the Cms-Run Docs.

Declaration
function run<T>(runParams: RunParamsWithContext)
Parameters
Type Name Description
RunParamsWithContext runParams

The complete run params with a context

Returns
Type Description
Promise<void | T>

A promise which triggers when the command has completed.