CMS.Helpers.WindowHelper.GetItem in Macros

Avi a asked on January 25, 2016 20:19

Hi,

anyone know if there is an equvilant to

CMS.Helpers.WindowHelper.GetItem

in Kentico Macros?

I could not find one, worse case I'll create a custom macro.

Thanks

Correct Answer

Martin Hejtmanek answered on January 26, 2016 08:57

Hi, this isn't mapped to macro engine, because it is essentially an abstraction of Session (at this moment), and we didn't want to expose potentially sensitive data from session to front-end developers without the access to source code.

If you make your custom macro method, I recommend to make it for that specific case, so instead of making method such as:

{% GetWindowHelperItem("somekey") %}

I recommend

{% GetMyWindowInformation() %}

Which would internally use window helper.

Also note that adding data to session may increase overhead of the application if you run it on more instances in cloud or in a web farm. If you could elaborate more about what you need to achieve, maybe there could be a better solution than session. Kentico uses WindowHelper primarily to pass short-term living parameters to new windows (typically dialogs) to not spam the session too much.

1 votesVote for this answer Unmark Correct answer

Recent Answers


Avi a answered on January 26, 2016 14:10

need to pass OrderID to my analytics 3rd party.

OrderID use to be passed in url on order complete.

Now a hash is passed and I need to convert it to ORderId and then pass that orderId to analytics.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.