ccrz.cc_hk_UserInterface.themeResourcePath

Returns the relative URL path from the storefront to a JavaScript or CSS file included a static resource for the storefront's enabled theme. Other methods of the ccrz.cc_hk_UserInterface class reference this path when constructing <script> or <link> elements for inclusion in each page's <head>.

Compatibility

This reference applies to:

Release Managed Package Version API Version
B2B Commerce for Visualforce Winter ’21 4.13 12
B2B Commerce for Visualforce Spring ’20 4.12 11
B2B Commerce for Visualforce Summer ’19 4.11 10
B2B Commerce for Visualforce Spring ’19 4.10 9
B2B Commerce for Visualforce Summer ’18 4.9 8

This method returns a value for either a Bootstrap 3- or Bootstrap 2.3.2-enabled storefront, where the Template Version storefront configuration setting is either boot3 or classic. We recommend that new solutions always use boot3.

Note

Signature

global static String themeResourcePath(String)

Inputs

elementPath
String that specifies the path to a specific file within the static resource for storefront's enabled theme.

This string can't begin with a forward slash character (/).

Note

Outputs

String that specifies the relative path from the storefront to a file in the theme's static resource, prefixed with the appropriate namespace, such as ccrz.

Example

The CC_Theme_Capricorn static resource that the managed package installs includes several files, such as styles.css and an override of the default uiproperties.js. To construct paths to these files, other methods of the ccrz.cc_hk_UserInterface class invoke the themeResourcePath method:

themeResourcePath('css3/styles.css')
themeResourcePath(js/uiproperties.js')

In a <link> or <script> element, these paths output as:

/DefaultStore/resource/1590503075000/ccrz__CC_Theme_Capricorn/css3/styles.css
/DefaultStore/resource/1590503075000/ccrz__CC_Theme_Capricorn/js/uiproperties.js