PagePlugin Extension

There are two types of Kooboo Extensions, PagePlugin and Module.

PagePlugin is an extension only to handle logic of one page. It contains no UI. It can be used on situation such as submitting data to remove web service or sending out an email. a Pageplugin can be attached to a Page or Content template.

PagePlugin API



On Kooboo, PagePlugin is a .NET class inherit from
Everest.CmsServices.Plugin.ControllerPluginBase, which is contained in Everest.CmsServices.dll.

There are 4 methods defined.
- PreGetExecute
- PrePostExecute
- AfterGetExecute
- AfterPostExecute


You can design html form in template, make the form action post to itself or to "". When the action="", form will post to itself.

Get or Post is the method defined in the html form.
Pre get executed before execution of Data Rule. After get executed after execution of Data Rule

You can use full .NET framework class library in the Plugin. You can also do a page redirect or directly return a MVC ActionResult.

PagePlugin Example



A very simple pageplugin will looks like below:

public class RedirectToPagePlugin : ControllerPluginBase
    {
        public override System.Web.Mvc.ActionResult PreGetExecute()
        {
            return this.Controller.ActionResultHelper.RedirectToPage("index", new { From = "plugin" });
        }
    }


Compile above code into a dll and upload it to application --> Extension --> PagePlugin

In the Content template editing or Page setting page, you will see a "Plugin" tab to select a PagePlugin to attach to a Page or Content template. See below screen.

Common questions



. 1. Which method to use
For data submission, we recommend to set the form method to post and use PrePostExecute or AfterPostExecute. If the page gets redirect after data submission, then we recommend using Pre method to save the time for Data Rule execution.

2. After data submission, which page it will go to?
You can define your own redirect. If you do nothing, it will return the same page or in other word the current View in MVC.

3. What if in the .NET class I need to add reference to third party dll?
You need to upload those third party dlls in the same location as PagePlugin.

4. How do I redirect to another page in Kooboo?
Under ControllerPluginBase class, there is method Controller.ActionResultHelper can be used to redirect page. You can find more information on our API document.

5. Can I access to MVC ViewData?
Yes, absolutely, both read and write are available.