Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: Execute other functions -- lifecycle

$
0
0
The magic word here is the FunctionContextContainer. Its not documented anywhere, but if you dig around in the source, you'll find some interesting things.

The basic idea is that you wrap your whole page-content inside your own function which allows you to add items to the container, which is then passed to all your child functions, which can then at any point retrieve items from the container.

Look at it as a HttpContext Items Collection, just within the context of C1 Functions.

I'm using it extensively myself, which you can see examples of here
Ps. If you use the Html.C1().Function(...) way to execute functions inside razor files, then make sure to always use the Html.C1().Function(..., FunctionContextContainer) overload, otherwise you'll find that your context is being cleard. I've reported it as an issue here https://github.com/Orckestra/C1-CMS/issues/191

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>