From 01fa5ac057db984e3c2d229e1534a9816b2cac08 Mon Sep 17 00:00:00 2001 From: Frank Date: Thu, 16 Dec 2021 14:49:40 -0500 Subject: [PATCH] Some comments --- src/helpers/cms-content-helper.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/helpers/cms-content-helper.js b/src/helpers/cms-content-helper.js index 0c80b5bd3..1d901d27e 100644 --- a/src/helpers/cms-content-helper.js +++ b/src/helpers/cms-content-helper.js @@ -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') {