Some comments
This commit is contained in:
parent
3cbc071bb4
commit
01fa5ac057
1 changed files with 5 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ export function fetchCmsContentForPage(fmgPage) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Function to convert a string, into a matching global state item.
|
||||||
function mapStringToState(str) {
|
function mapStringToState(str) {
|
||||||
|
|
||||||
// Pull the state string out of our dynamic string from the CMS
|
// Pull the state string out of our dynamic string from the CMS
|
||||||
|
|
@ -48,6 +49,8 @@ function mapStringToState(str) {
|
||||||
return storeState;
|
return storeState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parent function for processWidgetItemForReplacement. This will loop through the parent
|
||||||
|
// object and pass any objects that need additional processing to the processWidgetItemForReplacement function.
|
||||||
function findAndReplaceGlobalStateValues(widgetModel, widgetType) {
|
function findAndReplaceGlobalStateValues(widgetModel, widgetType) {
|
||||||
|
|
||||||
const objWithReplacements = {
|
const objWithReplacements = {
|
||||||
|
|
@ -65,6 +68,8 @@ function findAndReplaceGlobalStateValues(widgetModel, widgetType) {
|
||||||
return objWithReplacements;
|
return objWithReplacements;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This function will process the widget item and replace any global state variables with their values.
|
||||||
|
// This is a recursive function, it will call itself until it runs out of items to iterate on given the object.
|
||||||
function processWidgetItemForReplacement(widgetModel, key) {
|
function processWidgetItemForReplacement(widgetModel, key) {
|
||||||
// If we have a string, and it needs to be replaced.
|
// If we have a string, and it needs to be replaced.
|
||||||
if (typeof widgetModel[key] === 'string') {
|
if (typeof widgetModel[key] === 'string') {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue