Some comments

This commit is contained in:
Frank 2021-12-16 14:49:40 -05:00
parent 3cbc071bb4
commit 01fa5ac057

View file

@ -27,6 +27,7 @@ export function fetchCmsContentForPage(fmgPage) {
});
}
// Function to convert a string, into a matching global state item.
function mapStringToState(str) {
// Pull the state string out of our dynamic string from the CMS
@ -48,6 +49,8 @@ function mapStringToState(str) {
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) {
const objWithReplacements = {
@ -65,6 +68,8 @@ function findAndReplaceGlobalStateValues(widgetModel, widgetType) {
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) {
// If we have a string, and it needs to be replaced.
if (typeof widgetModel[key] === 'string') {