I18N Navigation - Custom Rendering
From version 3.0 onwards you can specify a component name as last parameter to get_i18n_navigation($slug, $minlevel=0, $maxlevel=0, $show=I18N_SHOW_NORMAL, $component=null).
To imitate the standard menu you could use a component like this:
<li class="<?php echo $item->classes; ?>"> <a href="<?php echo htmlspecialchars($item->link); ?>"> <?php echo htmlspecialchars($item->text); ?> </a> <?php if ($item->isOpen) { ?> <ul><?php $item->outputChildren(); ?></ul> <?php } ?> </li>
The following attributes to the current navigation item $item are available:
- slug - the slug of the page of this item
- parent - the parent of the page
- classes - the CSS classes that would be used for the <li> with standard rendering
- text - the menu text
- title - the title of the page
- isCurrent - true, if this is the currently active item, i.e. the current page or one of the children of this page that are not in the menu
- isCurrentPath - true, if this is the parent or an "ancestor" of the currently active item
- hasChildren - true, if this item has child items
- isOpen - true, if this item has child items (pages), which are currently shown in the menu
- isClosed - true, if this item has child items (pages), which are currently not visible in the menu
- showTitles - true, if the flag I18N_SHOW_TITLE was used in the call
- link - the link to the page
- simpleLink - the link to the page (does not contain a ?lang=.. parameter)
The following attributes are lazily loaded from the page files - thus they might slow down the menu rendering, if used for large menus:
- content - the content of the page
- tags - the tags/keywords of the page as array of strings
- any custom fields, e.g. specify image to get the custom/special field named image.
Additionally there is the function
- outputChildren() - output the children of the item. Call it only if $item->isOpen is true.