Try explicitly setting the location value of the menu item to an empty string: $nav['my_menu_item'] = array('label' => 'My Menu Item', 'location' => '');
If I set the location to empty string, the submenus aren't generated. Also I'll have an anchor pointing to the base url. To be clear, I generate menu from DB, so I set the location field to empty manually. Thanks
EDIT: I have the submenus from the db query array, but after pushing to render method, they don't generate.
Unless I misunderstand, I believe it should work for you if you provide the proper nav key in the admin. So for example, if you create a menu item with the location value as empty but specify the "nav key" to say "blank" and then have all the child menu elements specify their parent value to "blank", it should render the menu with it's children.
I'd like to do that but using only the admin and the fuel_nav() function...
Basically this kind of already works: you can create a menu item and specify an empty location. This is handled well by the fuel_nav() function as it will generates only a li without the anchror tag. The problem is that you can have only one menu item without a location. If you try to add another you will have an "The Location is empty or already exists." error when saving.
I thought modifying the navigation_model as following will do the trick but creating a new item with an empty location will actually replace the existing one
Any workaround possible?
function is_new_location($location, $group_id, $parent_id) { if (empty($group_id)) return FALSE; + if ($location == '') + return TRUE; [...] }
Ok, I've changed the (group_id, location, parent_id) unique index to normal index. It's seems to work well at first sight, I'll play a bit with it in dev...
Haven't looked for performance loss but since the number of items shouldn't reach more than 20 it shouldn't be a problem.
Comments
$nav['my_menu_item'] = array('label' => 'My Menu Item', 'location' => '');
To be clear, I generate menu from DB, so I set the location field to empty manually.
Thanks
EDIT: I have the submenus from the db query array, but after pushing to render method, they don't generate.
http://bit.ly/tDFgkg
Basically this kind of already works: you can create a menu item and specify an empty location. This is handled well by the fuel_nav() function as it will generates only a li without the anchror tag.
The problem is that you can have only one menu item without a location. If you try to add another you will have an "The Location is empty or already exists." error when saving.
I thought modifying the navigation_model as following will do the trick but creating a new item with an empty location will actually replace the existing one
Any workaround possible?
function is_new_location($location, $group_id, $parent_id)
{
if (empty($group_id)) return FALSE;
+ if ($location == '')
+ return TRUE;
[...]
}
It's seems to work well at first sight, I'll play a bit with it in dev...
Haven't looked for performance loss but since the number of items shouldn't reach more than 20 it shouldn't be a problem.
Thanks!