K2BMenu Pattern


Implementing the load procedure for a Menu is not a simple task. A typical menu can contain several items, spanned over many sublevels. Because of this, the code that generates that structure can be complex. Also, in order to follow best practices, menu items and sublevels should be included only when the logged in user has permission to access such elements. This leads to a cumbersome implementation, and high error rates when programming it.

To simplify this task, avoiding manual programming, K2BMenu pattern can be used. K2BMenu pattern generates two procedures:

  • Static procedure: The generated procedure returns an instance of the K2BMultiLevelMenu SDT, that is in turn used by the K2BAccordionMenu User Control to display the menu in runtime. When loading the menu, this procedure checks that the user has permission to access each menu item before including them.
  • Initialization procedure: the generated procedure can be used to initialize and maintain the corresponding database tables with the options available in the KB. This can be used together with the GAM integration module to initialize the GAM Menu database.

As an example, the following menu was created using this pattern and the K2BAccordionMenu user control.

K2BMenuInstance K2BMenuExample
K2BMenu instance K2BMenu in RunTime

More Information

If you are starting to use this pattern, we recommend the quick start guide.

Detailed information can be found in the documentation for the nodes that are included in the pattern instance, and the user guides associated with this pattern.

Subcribe to this category's changes
Sub CategoriesAdd a new subcategory in this category
PagesAdd a new page in this category