Wix.Settings

addComponent

Allows users to install add-ons in your app, directly from the App Settings panel. Users are then directed to the page where the component was added.

SDK Version: SDK 1.92.0+
Editor Version: New Editor
Components: Settings Panel, Settings Modal

Use this method for add-ons that aren’t added automatically when users install your app, or to allow users to add a page component again. Note that for page components, you need to first allow users to add your page component more than once.

Syntax:

Copy
1
addComponent(options, onSuccess, \[onFailure\])

Parameters:

NameTypeDescription
options (required)ObjectOptions for this method
options.copyStyleBooleanTo copy the style from another component in your app, set true. You can copy the style as follows: To copy the style of the calling component, leave styleId empty. To copy the style of another component in your app, enter its styleId below.
options.styleIdStringID of the style to copy. Make sure copyStyle is set to true. If the styleId is invalid, no style will be copied.
options.componentType (required)"WIDGET" or "PAGE"Type of component to add
options.widgetObjectDetails about the widget and where to add it
options.widget.widgetId (required)StringID of the widget, as specified in the Dev Center
options.widget.allPagesBooleanTrue if the user is adding the widget to all pages. Default is False. If the value is True and you also specify the wixPageId (below), then allPages takes precedence and the component is added to all pages.
options.widget.wixPageIdStringID of the page where the user is adding the widget. If a value is given and the value of allPages (above) is True, then allPages takes precedence and the component is added to all pages. The user is directed to this page once the widget is added.
options.pageObjectDetails about the page component. Make sure that you allow users to add your page component more than once.
options.page.titleStringThe title of the page. If undefined, uses the component name defined in the Developers Center. Title is limited to 40 characters, and cannot include ‘<’ or ’>’ characters.
options.page.pageId (required)StringID of the page component, as specified in the Developers Center
options.page.isHiddenBooleantrue if this is a hidden page. Default is false.
onSuccess (required)FunctionReceives the widget's compId
onFailureFunctionReceives the error if the operation failed. WIDGET](#1470038924639-675076e3-d3bd), PAGE

WIDGET EXAMPLE

Copy
1
Wix.Settings.addComponent(
2
{
3
componentType: 'WIDGET',
4
copyStyle: true,
5
widget: {widgetId: 'minicart'}
6
},
7
function(x) {
8
console.info(x)
9
},
10
function(x) {
11
console.error(x)
12
}
13
)

PAGE EXAMPLE

Copy
1
Wix.Settings.addComponent(
2
{
3
componentType: 'PAGE',
4
page: {pageId:'menu'}
5
},
6
function(x) {
7
console.info(x)
8
},
9
function(x) {
10
console.error(x)
11
}
12
)

closeWindow

Closes the settings/modal endpoint.

SDK Version: SDK 1.83.0+
Editor Version: New Editor
Components: Settings Panel, Settings Modal

Syntax:

Copy
1
closeWindow(\[options\])

Parameters:

NameTypeDescription
optionsObjectOptions for this method. Note: The options object is only passed to the opener's onClose callback function if you're closing the modal (target: 'MODAL') - refer to Wix.Settings.openModal.
options.target‘SETTINGS’, ‘MODAL’, ‘ALL’Specifies the endpoint to close: ‘SETTINGS’ - closes the settings endpoint. ‘MODAL’ (default) - closes the settings modal and passes the options object to the opener's onClose callback function (refer to Wix.Settings.openModal). ‘ALL’ - closes both the settings and the settings modal.
options.customObject/ String/ Boolean/ NumberA custom parameter

Example:

Copy
1
var custom = {"reason": "button-clicked"};
2
Wix.Settings.closeWindow({target: 'ALL', custom});

getCurrentPageAnchors

Retrieves the anchors on the current page.

SDK Version: SDK 1.62.0+
Editor Version: New Editor

Syntax:

Copy
1
getCurrentPageAnchors(callback)

Parameters:

NameTypeDescription
callback (required)FunctionCallback function to receive an array of anchors (unordered)

Value passed to callback:

An array of unordered objects. 

Each object represents an anchor on the current page, and contains the following properties:

NameTypeDescription
idStringThe anchor ID
titleStringThe anchor title.

Note: If there are no anchors on the current page, returns just one default anchor – the top of the page.

Example:

Copy
1
Wix.Settings.getCurrentPageAnchors(function(anchors) {
2
// do something with anchors
3
});

getCurrentPageId

Returns the page ID of the current page.

SDK Version: SDK 1.86.0+
Editor Version: New Editor
Components: Settings Panel, Settings Modal

Syntax:

Copy
1
getCurrentPageId(callback)

Parameters:

NameTypeDescription
callback (required)FunctionCallback function to receive the pageId

Example:

Copy
1
Wix.Settings.getCurrentPageId(function(pageId) {
2
//store the site pageId
3
});

getDashboardAppUrl

Retrieves the URL of your app’s Dashboard component within the user’s site (the URL is fully qualified). Use this URL to direct the user from the App Settings to your app’s Dashboard component.

SDK Version: SDK 1.32.0+
Editor Version: New Editor, Old Editor
Components: Multicomponent Apps

To open your Dashboard as a modal in the Wix Editor, use Wix.Settings.openModal.

Important:
To open your Dashboard component, add an href attribute with the Dashboard URL. Don’t use window.open – if you use window.open in a callback of an asynchronistic call, the browser blocks the window from opening.

Syntax:

Copy
1
getDashboardAppUrl(callback)

Parameters:

|Name |Type |Description|
|---|---|---| 
|callback (required)|Function|A callback function to receive the URL of the app in the dashboard|

Example:

Copy
1
Wix.Settings.getDashboardAppUrl(function(url) {
2
// do something with the URL
3
});

getSiteInfo

Retrieves information about the host site in which the app is shown.

SDK Version: SDK 1.12.0+
Editor Version: New Editor, Old Editor

Syntax:

Copy
1
getSiteInfo(callback)

Parameters:

NameTypeDescription
callback (required)FunctionCallback function to receive the site info 

Value passed to callback:

json Object containing the site info:

NameTypeDescription
baseUrl String Base url of the current site, for example: http://user.wix.com/site-name, http://www.domain.com
pageTitle String The page title that is used for SEO. This title includes both the site and page title (e.g., “My Store - Animal Shirt”).
pageTitleOnlyStringThe name of the page - without the site title (e.g., “Animal Shirt”).
referrer String The referrer header of the HTTP request 
siteDescriptionString The description of the site that is used for SEO 
siteKeywordsString The keywords which are related to the site and are used for SEO 
siteTitle String The title of the site that is used for SEO 
url String The URL (taken from the location.href property). The URL includes the internal site state, for example: http://user.wixsite.com/site-name/pageTitle http://www.domain.com/pageTitle . Returns the site URL only when using getSiteInfo in the live site and preview mode. When using it in Editor mode, returns the Editor URL.

Example:

Copy
1
Wix.Settings.getSiteInfo(function(siteInfo) {
2
// do something with the siteInfo
3
});

getSiteMap

Returns all items in the site structure, including:

  • Items in the site’s menu – pages (including subpages), links, and menu headers.
  • Hidden pages – pages that are in the site, but not in the site menu. For example, a “Thank You” page that’s shown only after a site visitor makes a purchase.

SDK Version: SDK 1.81.0+
Editor Version: New Editor
Components: Settings Panel

Note:
Use this method instead of getSitePages, which is now deprecated.

Syntax:

Copy
1
getSiteMap(callback)

Parameters:

NameTypeDescription
callback (required)FunctionCallback function to receive the site structure

Value passed to callback:

An array of objects, where each object represents an item in the site structure.

Warning:
To use this object later (for example, if you want to navigate to a link on the user’s site), save this object in your database as is – don’t change it in any way.

Each object contains data about the item. The data sent depends on the item – check out our examples below.

NameTypeDescription
typeStringType of link the item represents - for example ‘PageLink’ or ‘AnchorLink’. The data returned depends on the item - for example, an ‘AnchorLink’ object will include the anchorName and anchorDataId properties. Check out our examples below.
pageIdStringThe page ID. Note: If the user added a page anchor to the site’s menu, then this method returns an object for the anchor - so there might be multiple objects with the same page ID.
titleStringThe item title
hiddenBooleanReturns true if this page is hidden
isHomePageBooleanReturns true if this page is the site's home page
urlStringURL of this item
subPagesArray [objects](Page objects only) If the page has subpages, returns an ordered set of subpages. Each subpage object contains more information about the subpage (id, title, hide, isHomePage, url).

Here’s an example of an array passed to the callback:

Copy
1
[
2
{
3
"type": "PageLink",
4
"pageId": "#c1dmp",
5
"title": "HOME",
6
"hidden": false,
7
"isHomePage": true,
8
"url": "http://site.wixsite.com/name-dp"
9
},
10
{
11
"type": "PageLink",
12
"pageId": "#kyck4",
13
"title": "Page",
14
"hidden": false,
15
"isHomePage": false,
16
"url": "http://site.wixsite.com/name-dp/page"
17
},
18
{
19
"type": "AnchorLink",
20
"anchorName": "Anchor",
21
"anchorDataId": "#dataItem-iyk5xcst",
22
"pageId": "#c1dmp",
23
"title": "anchor link",
24
"hidden": false,
25
"isHomePage": true,
26
"url": "http://site.wixsite.com/name-dp"
27
},
28
{
29
"type": "ExternalLink",
30
"target": "_blank",
31
"url": "http://google.com",
32
title": "external",
33
"hidden": false
34
},
35
{
36
"type": "EmailLink",
37
"recipient": "site@a.com",
38
"subject": "dffg",
39
"title": "email",
40
"hidden": false
41
},
42
{
43
"type": "PhoneLink",
44
"phoneNumber": "123544216142",
45
"title": "phone",
46
"hidden": false
47
},
48
{
49
"type": "DocumentLink",
50
"docId": "7a9325_da6cc4b5cb65468bafbd937a9133aed0.pdf",
51
"name": "file.pdf",
52
"title": "document",
53
"hidden": false,
54
"url": "http://media.wix.com/ugd/7a9325_da6cc4b5cb65468bafbd937a9133aed0.pdf"
55
},
56
{
57
"type": "DynamicPageLink",
58
"routerId": "routers-iympnnog",
59
"innerRoute": "fgfg",
60
"title": "dynamic page",
61
"hidden": false
62
},
63
{
64
"type": "MenuHeader",
65
"title": "Menu Header",
66
"hidden": false,
67
"subPages": [
68
{
69
"type": "PageLink",
70
"pageId": "#rsdvc",
71
"title": "New Page",
72
"hidden": false,
73
"isHomePage": false,
74
"url": "http://site.wixsite.com/name-dp/new-page"
75
}
76
]
77
}
78
]

Example:

Copy
1
Wix.Settings.getSiteMap(function(siteMap) {
2
// do something with the site pages
3
});

getStateUrl

This method returns the full URL of one of your internal pages on the live site, including the app’s state.
For example: mysite.com/my-store-app/product1.
As you can see, the URL includes the app state.

SDK Version: SDK 1.69.0+
Editor Version: New Editor

Use this method if you have a page component and you need the URL of an internal page.

Note:
This method won’t work if the user didn’t save the site since installing your app (you’ll get an error in the response).

Syntax:

Copy
1
getStateUrl(sectionId, state, callback)

Parameters:

NameTypeDescription
sectionId (required)StringID of the Page component, as specified in the Developers Center
state (required)StringState of the app’s internal page - for example, ‘product1
callback (required)FunctionCallback function to receive the full URL of the page, including the app state

Example:

Copy
1
Wix.Settings.getStateUrl('myStoreApp', 'product1', function(a) {
2
console.log(a)}
3
);

getWindowPlacement

Gets the position of a fixed position widget in an editing session. Read more about position placement in the Editor.

SDK Version: SDK 1.19.0+
Editor Version: New Editor, Old Editor
Components: Settings Panel (for Fixed-Position Widgets only), Settings Modal (for Fixed-Position Widgets only)

Syntax:

Copy
1
getWindowPlacement(compId, callback)

Parameters:

NameTypeDescription
compId (required)StringComponent ID of the fixed-position widget
callback (required)FunctionA callback function that gets the component placement

Example:

Copy
1
var compId = Wix.Utils.getOrigCompId();
2
Wix.Settings.getWindowPlacement(compId, function(data) {
3
// do something with widget placement
4
});

Note:
Use this for fixed-position widgets only – otherwise, an error will be thrown.

isApplicationInstalled

Allows you to check if another one of your apps is installed.

SDK Version: SDK 1.83.0+
Editor Version: New Editor
Components: Settings Panel, Settings Modal

Syntax:

Copy
1
isApplicationInstalled(appDefinitionId, callback)

Parameters:

NameTypeDescription
appDefinitionId (required)StringApp ID, as specified in the Devevelopers Center
callback (required)FunctionCallback function that receives a boolean indicating if the app is installed in the site: function(isInstalled) {}

Value passed to callback:

A boolean indicating if the app is installed or not:

  • true if the app is installed
  • false if the app isn’t installed

Example:

Copy
1
Wix.Settings.isApplicationInstalled(
2
'1380b703-ce81-ff05-f115-39571d94dfcd',
3
function(isInstalled){console.log(isInstalled)}
4
);

isComponentInstalled

This method is for multicomponent apps. Use it to check if one of your app’s components is installed in the user’s site.

SDK Version: SDK 1.74.0+
Editor Version: New Editor
Components: Settings Panel

Syntax:

Copy
1
isComponentInstalled(componentId, callback)

Parameters:

NameTypeDescription
componentId (required)StringID of the component, as specified in the Developers Center
callback (required)FunctionFunction that receives a boolean indicating if the component is installed in the site

Value passed to callback:

A boolean indicating if the component is installed or not:

  • true if the component is installed
  • false if the component isn’t installed

Example:

Copy
1
Wix.Settings.isComponentInstalled("compId", function(data){console.log(data)})

isFullWidth

Indicates if the user extended the component to full width.

SDK Version: SDK 1.65.0+
Editor Version: New Editor

Syntax:

Copy
1
isFullWidth(callback)

Parameters:

NameTypeDescription
callback (required)FunctionFunction that receives a boolean indicating if the app is set to full-width

Value passed to callback:

A boolean indicating if the component is set to full-width:

  • true if the component is set to full-width

  • false if the component isn’t set to full-width

Example:

Copy
1
Wix.Settings.isFullWidth(function() {...});

openBillingPage

Opens the Wix billing page from the settings panel in a modal window.

SDK Version: SDK 1.16.0+
Editor Version: New Editor, Old Editor

Syntax:

Copy
1
openBillingPage( )

Example:

Copy
1
Wix.Settings.openBillingPage();

openLinkPanel

This method opens the Editor’s link settings panel, where users can add a link to content in your app (an image, text, etc.).

SDK Version: SDK 1.81.0+
Editor Version: New Editor
Components: Settings Panel

How to use this method:

  1. Call this method when a user is adding a link in your app. Users will be able to link to an anchor on their site, an external link, and more.
  2. Save the return object. This method returns a link data object – save the object on your database, without changing it in any way.
  3. Use the return object to navigate to the link target. In the live site/preview, use the Wix.navigateTo method to navigate to the link target.
  4. Use the return object the next time you call openLinkPanel. This will open the panel with the current link settings displayed.

Note:
Want to learn more? To see how the link panel works inside the Wix Editor, check out this video.

Syntax:

Copy
1
openLinkPanel(\[options\], onSuccess, \[onCancel\])

Parameters:

NameTypeDescription
optionsObjectOptions for this method
options.linkObjectIf the user is editing an existing link, add the link data object we returned the last time you called this method. This opens the panel with the current link settings displayed.
onSuccess (required)FunctionFunction called when the user clicks Done in the link settings panel, and returns an object containing the selected link data callback signature: function(linkData) {}
onCancelFunctionFunction called when the user clicks Cancel in the link settings panel.

Value passed to callback:

A link object with information about this link.

Warning:
Save this object in your database as is – don’t change it in any way.

Here’s when to use the link object object:

  • To navigate to the link target in the live site/preview (use the Wix.navigateTo method)
  • The next time you open the link panel with the user’s settings.

Here’s an example of a link object for a page:

Copy
1
{
2
"type": "PageLink",
3
"pageId": "#c1dmp"
4
}

Example:

Copy
1
Wix.Settings.openLinkPanel({
2
link: {
3
"type": "PageLink",
4
"pageId": "#c1dmp"
5
}},
6
function(linkData) {console.log(linkData), function(error){console.log(error)}; }
7
);

openMediaDialog

This method opens the Wix Media Manager, which allows users to choose an existing item from the Wix media galleries or upload a new file.

SDK Version: SDK 1.17.0+
Editor Version: New Editor, Old Editor

Once the user selects a media item, a callback function retrieves a metadata descriptor with details about it.

To access the media item, use one of the Wix.Utils.Media.get* methods to construct the item’s full URL. You’ll need the item’s relativeUri, which is returned in the callback function.

Syntax:

Copy
1
openMediaDialog(mediaType, multiSelect, onSuccess, \[onCancel\])

Warning:
Use the Wix.Utils.Media.get* methods each time you access the media item, to prevent broken links.

Parameters:

NameTypeDescription
mediaType (required)Wix.Settings.MediaType.IMAGE, Wix.Settings.MediaType.BACKGROUND, Wix.Settings.MediaType.AUDIO, Wix.Settings.MediaType.SECURE_MUSIC, Wix.Settings.MediaType.DOCUMENT, Wix.Settings.MediaType.SWFType of media item the user is selecting: * IMAGE (photo/image) * BACKGROUND (background image) * AUDIO (mp3 file up to 50MB) * SECURE_MUSIC (high quality audio up to 360MB) * DOCUMENT * SWF
multiSelect (required)Booleantrue if the user selected more than one item. false if the user selected only one item.
onSuccess (required)FunctionCallback function to pass metadata about this media item
onCancelFunctionCallback function called when the user cancels

Value passed to onSuccess callback:

An object or an array of objects (for multiple media items).

Each object contains metadata about a specific media item.

Example:

Copy
1
Wix.Settings.openMediaDialog(Wix.Settings.MediaType.IMAGE, false, function(data) {
2
let imageurl = Wix.Utils.Media.getImageUrl(data.relativeUri);
3
});

openModal

Opens a lightbox-style modal window over the Wix editor. You can only open this modal from the settings endpoint.

SDK Version: SDK 1.41.0+
Editor Version: New Editor, Old Editor

Here’s how the modal works:

  • The modal is a runtime widget, so it’s not part of the site structure.
  • The modal is a singleton – every new modal closes the previous one.
  • Users can close the modal by clicking the lightbox or pressing the close button. You can close the modal by calling Wix.Settings.closeWindow from within the modal iframe.

Syntax:

Copy
1
openModal(url, width, height, \[title\], \[onClose\])

Breaking change for the openModal method

We’ve deprecated the bareUI parameter, which means that the modal now has a header, border, shadow, etc. If your app is using the bareUI parameter:

  1. Remove bareUI from Wix.Settings.openModal.
  2. Now that the modal style changed, we recommend adding a title and changing your design if needed.

Parameters:

NameTypeDescription
url (required)StringURL of the modal iframe
width (required)Number/ StringWidth of the modal. In pixels: Enter a number (for example, 400), In percent: Enter a string (for example, ‘70%’)
height (required)Number/ StringHeight of the modal. In pixels: Enter a number (for example, 400), In percent: Enter a string (for example, ‘70%’)
titleStringThe title of the modal
onCloseFunctionOnClose callback function

Example:

Copy
1
var onClose = function(message) { console.log("modal closed", message); }
2
3
//Open a modal when width and height are in pixels
4
Wix.Settings.openModal(
5
"https://static.wixstatic.com/media/3cd1de924697419088c1e033bb3384ef.jpg",
6
400,
7
400,
8
"My modal's title",
9
onClose
10
);
11
12
//Open a modal when width and height in percentages
13
Wix.Settings.openModal(
14
"https://static.wixstatic.com/media/3cd1de924697419088c1e033bb3384ef.jpg",
15
'70%',
16
'90%',
17
"My modal's title",
18
onClose
19
);

openReviewInfo

Opens your app’s Reviews tab as a modal within the Wix Editor.

SDK Version: SDK 1.65.0+
Editor Version: New Editor

Syntax:

Copy
1
openReviewInfo( )

Example:

Copy
1
Wix.Settings.openReviewInfo();

openSiteMembersSettingsDialog

Opens the settings for the Wix’s site members component, directly from your app. This method first closes all other open dialogs or panels in the editor.

SDK Version: SDK 1.74.0+
Editor Version: New Editor
Components: Settings Panel

This method is relevant for apps that require site visitors to log in as members of the site.

Syntax:

Copy
1
openSiteMembersSettingsDialog()

Example:

Copy
1
Wix.Settings.openSiteMembersSettingsDialog()

refreshApp

Reloads the app. Use this method when the user makes a change that affects the entire app – and it requires server-side rendering. For example, when the user connects an account.

SDK Version: SDK 1.12.0+
Editor Version: New Editor, Old Editor

Don’t use this method when:

  • The change only affects one of your app’s components. In this case, use refreshAppByCompIds instead.
  • The user made a small change in your app – like customized text. In this case, use the triggerSettingsUpdatedEvent instead.

This method accepts a single optional argument, an object. Each of the object’s properties will translate into a query parameter in the iframe URL.

Syntax:

Copy
1
refreshApp(\[queryParams\])

Parameters:

NameTypeDescription
queryParamsObjectA map of custom query parameters that should be added to the iframe URL 

Example:

Copy
1
//The App's components (all of them) will be refreshed without custom query parameters
2
Wix.Settings.refreshApp();
3
4
//The App's components (all of them) will be refreshed with custom query parameters as specified in the object argument - [BASE-URL]?[WIX-QUERY-PARAMETERS]&m1=value1&m2=value2
5
6
Wix.Settings.refreshApp({param1: "value1", param2: "value2"})

refreshAppByCompIds

Reloads the component. Use this method when the user makes a change that requires server-side rendering, and this change only affects specific components.

SDK Version: SDK 1.12.0+
Editor Version: New Editor, Old Editor

Don’t use this method when:

  • The change affects all of your app’s components. In this case, use refreshApp instead.
  • The user made a small change in your app. In this case, use the triggerSettingsUpdatedEvent instead.

Syntax:

Copy
1
refreshAppByCompIds(compIds, \[queryParams\])

Parameters:

NameTypeDescription
compIds (required)ArrayAn array of the app component ids that should be refreshed 
queryParams ObjectA map of custom query parameters that should be added to the iframe URL

Example`

Copy
1
//For example, if the user adds 3 components of the same app with ids: "id1", "id2" and "id3", and then he changes something in the settings iframe that affects only 2 components display, to refresh these 2 components:
2
3
//The App's components with ids "id1" and "id3" will be refreshed without custom query parameters
4
Wix.Settings.refreshAppByCompIds(["id1", "id3"]);
5
6
//The App's components with ids "id1" and "id3" will be refreshed with custom query parameters as specified in the object argument - [BASE-URL]?[WIX-QUERY-PARAMETERS]&m1=value1&m2=value2
7
8
Wix.Settings.refreshAppByCompIds(["id1", "id3"], {param1: "value1", param2: "value2"});

resizeComponent

Sets the width and/or height of a component, displaying it over other components in the page.

SDK Version: SDK 1.45.0+
Editor Version: New Editor
Components: Settings Panel (for Widgets/Pages only)

Syntax:

Copy
1
resizeComponent(options, onSuccess, \[onFailure\])

Parameters:

NameTypeDescription
options (required)ObjectSpecify width and/or height (you must specify at least one)
options.widthNumberSize in pixels, for example: 450. If you don’t provide a value, the width remains the same.
options.heightNumberSize in pixels, for example: 450. If you don’t provide a value, the height remains the same.
onSuccess (required)FunctionCallback function to receive the new component size
onFailureFunctionCallback function to receive the error details. An error occurs when no value is provided for width and height (you must give a value for at least one).

Example:

Copy
1
Wix.Settings.resizeComponent({
2
width: 400,
3
height: 600
4
});

revalidateSession

Verifies that the session is secure. If the session is secure, this method retrieves a newly-signed app instance.

SDK Version: SDK 1.47.0+
Editor Version: New Editor

Use this method before displaying sensitive information or performing an action that requires a secure session.

Syntax:

Copy
1
revalidateSession(onSuccess, \[onFailure\])

Parameters:

NameTypeDescription
onSuccess (required)FunctionReceives a newly-signed and encoded app instance
onFailure FunctionCallback function in case the session isn't secure

Example:

Copy
1
Wix.Settings.revalidateSession(
2
function(instanceData) {
3
//handle success use-case
4
},
5
function(error){
6
//Handle error use-case
7
}
8
);

setFullWidth

Sets the widget/page component to the full-width of the browser.

SDK Version: SDK 1.81.0+
Editor Version: New Editor
Components: Settings Panel (for Widgets/Pages only)

Syntax:

Copy
1
setFullWidth(fullWidth, \[options\], onSuccess, \[onFailure\])

Parameters:

NameTypeDescription
fullWidth (required)BooleanSet the width:. Enter true to set the component to full width, enter false to reset the component to the width you defined in the Developers Center.
optionsBooleanOptions for this method
options.marginsObjectWhen the component is set to full width, you can define margins on the left and right sides of the component. For example: {left: "200px", right: "200px"}. Enter the value in px (default) - number of pixels to leave as a margin, or % - percentage of the viewport to leave as a margin. If you don’t specify a unit, we use px. You can specify different units for the left and right sides: {left: "5%", right: "200px"}
onSuccess (required)FunctionCallback function that’s fired when the component is set to full-width successfully
onFailureFunctionCallback function that’s fired when the component can’t be set to full-width (for example, a fixed-position widget)
Copy
1
Wix.Settings.setFullWidth(true, {margins: {left: "200px", right: "200px"}}, function() {..}, function() {...});

setWindowPlacement

Sets the placement for fixed position widgets in an editing session.

SDK Version: SDK 1.19.0+
Editor Version: New Editor, Old Editor
Component: Settings Panel (for Fixed-Position Widgets only)

A position placement is a predefined set of locations where a popup will be placed. The position placement is defined under Wix.WindowPlacement and can have the following values:

  1. Wix.WindowPlacement.TOP_LEFT
  2. Wix.WindowPlacement.TOP_CENTER
  3. Wix.WindowPlacement.TOP_RIGHT
  4. Wix.WindowPlacement.CENTER_RIGHT
  5. Wix.WindowPlacement.CENTER_LEFT
  6. Wix.WindowPlacement.BOTTOM_LEFT
  7. Wix.WindowPlacement.BOTTOM_CENTER
  8. Wix.WindowPlacement.BOTTOM_RIGHT

Syntax:

Copy
1
setWindowPlacement(compId, placement, \[verticalMargin\], \[horizontalMargin\])

Parameters:

NameTypeDescription
compId (required)StringComponent id to change window placement to
placement (required)Wix.WindowPlacement New placement for the widget window 
verticalMarginNumberVertical offset from the window placement, between -2 to 2 
horizontalMarginNumberHorizontal offset from the window placement, between -2 to 2

Example:

Copy
1
var compId = Wix.Utils.getOrigCompId();
2
Wix.Settings.setWindowPlacement(compId, Wix.WindowPlacement.TOP_CENTER, 2, 0);

triggerSettingsUpdatedEvent

Triggers a Wix.Events.SETTINGS_UPDATED event in a component iframe. It should be used in an editing session when a developer wants to reflect editing changes but avoid refresh/reload of the component’s iframe.

SDK Version: SDK 1.17.0+
Editor Version: New Editor, Old Editor

Syntax:

Copy
1
triggerSettingsUpdatedEvent(message, \[compId\])

Parameters:

NameTypeDescription
message (required)Object A custom json which will be passed to the component as the event data
compIdStringA component ID the developer wants to trigger the event for. The most obvious compId is Utils.getOrigCompId(). If no compId is given all components that registered to Wix.Events.SETTINGS_UPDATED will receive the event.

Example:

Copy
1
Wix.Settings.triggerSettingsUpdatedEvent(message, compId);

Deprecated

getSitePages

SDK Version: Deprecated

Note:
Now that this method is deprecated, use the getSiteMap method instead.

A page can be:

  • An item in the site’s menu – a page, subpage, external link, link to a page anchor, or menu header.
  • A hidden page/subpage – these pages are part of the site, but they’re not part of the site menu. For example, a “Thank You” page that’s shown only after a site visitor makes a purchase.

Parameters:

NameTypeDescription
optionsObjectOptions for this method
callback (required)FunctionA callback function to receive the site structure

Value passed to callback:

An array of objects, where each object represents a page in the site.

The objects are ordered according to the site’s structure shown in the Pages menu of the Wix Editor. If a page has subpages, they are returned as an array of objects nested inside the page object.

Each page/subpage object contains the following properties:

NameTypeDescription
idStringThe page/subpage ID. If the user added a page anchor to the site’s menu, then this method returns an object for the anchor - so there might be multiple objects with the same page ID.
titleStringThe title of the page/subpage
hideBooleanReturns true if this page/subpage is hidden
isHomePageBooleanReturns true if this page/subpage is the site's home page
subPagesArray [objects](Page objects only) If the page has subPages, returns an ordered set of subpages. Each subpage object contains more information about the subpage (id, title, hide, isHomePage, url).

Example:

Copy
1
Wix.Settings.getSitePages(function(sitePages) {
2
// do something with the site pages
3
});

getStyleParams

SDK Version: Deprecated

Retrieves the style parameters from the hosting Wix platform. The parameters includes colors numbers, booleans.

Parameters:

NameTypeDescription
callback (required)FunctionA callback function to receive the style parameters 

Example:

Copy
1
Wix.Settings.getStyleParams(function(styleParams) {
2
// do something with the style params
3
});
Was this helpful?
Yes
No