-
Templating and Integration Guide
- Part 1: Concepts
- Part 2: Modules
- Part 3: Templates and Studio
- Part 4: Content Definitions and Views
- Part 5: Advanced Techniques
- Part 6: Setting up an integration environment
- Part 7: Step by step integration
- Further reading and resources
Customization
Customization may be done at two different levels: on the menu structure itself (navMenu.jsp), and on the rendering of menu items (navMenuItem.menuElement.jsp).
Menu structure
You may for instance add a view to a menu (jnt:navMenu) to change its structure or add Javascript to build complex menus. The new view will be automatically available in the layout tab of the menu engine.
You just have to create a new file under the jnt_navMenu/html folder or create this folders tree in your module directory, named navMenu.<yourView>.jsp where <yourView> is your view name.
In a file named navMenu.<yourView>.properties you have to set two properties for this view, as they are needed to manage cache dependency which is very important on menus (because of recursivity of the display code).
cache.mainResource = true
cache.mainResource.flushParent = true
The best practice is to copy one of the predefined menus that is the closest to your needs and to customize it.
At the beginning of the file the properties are setup to prepare the display of the menu. The display part is between the <ul> tags.
Rendering items
The default view for items in a menu is defined in the menuElement view. The rendering is applied on jmix:navMenuItem, which means that the default JSP file used for rendering items will be located in the file :
jahia/modules/default/jmix_navMenuItem/html/navMenuItem.menuElement.jsp
You can define your own menu items by adding the jmix:navMenuItem to your own type definitions. If you want a customized display, you will need to create a new menuElement view for your new type definitions. For example Jahia uses a custom view for jnt:page items. This choice will let you add properties such as icons (reference to a file) or alternate text for a menu item.
Example:
[jnt:navMenuText] >jnt:content, mix:title, jmix:navMenuItem
+ * (jmix:navMenuItem)
or
[jnt:page] > nt:base, jmix:nodenameInfo, jmix:observable, jmix:basemetadata, mix:title, jmix:publication, jmix:tagged, jmix:navMenuItem, jmix:hasTemplateNode
orderable
- jcr:title (string) i18n mandatory
- j:templateNode (weakreference,choicelist[templatesNode]) mandatory < jnt:template
+ * (nt:base) = nt:base version
+ * (jmix:navMenuItem)
+ * (jmix:navMenuItem) let you add sub menu items under your current menu item.
You can also define your own view for items. You will also need to define a default view for it. This view will be available in the jnt:navMenu view list in the studio. All items in the menu will then use the same view.

