Modal Box in Navigation array
Hi,
I'd like to implement a modal box within the navigation array. I'm trying to use bootstrap's modal functionality, so I need the link to have an attribute like data-toggle='modal'. How can this be coded into the navigation array? I have a seen that a container_tag_attrs exists for the main container, this is pretty close to what I want except that it doesn't seem to be available for a specific item.
Thanks a lot in advance,
Jan
Comments
$nav['my_menu_item'] = array('label' => 'My Menu Item', 'location' => 'my_location', 'attributes' => 'data-toggle="modal"');
thank you very much for your continued support, it is very much appreciated and much much better than in other CMS/software packages! It works flawlessly.
Secondly, if so, is there a way give a data attribute that is based on something specific to each link (id, title or anything really)? For context we are attempting to add some click tracking data and would rather add it to our code than go into the CMS and add it for each menu item individually.
Here's an example of how we load the nav:
<?=fuel_nav(array('group_id' => 'Primary', 'parent' => uri_segment(1), 'container_tag_class' => 'f-dropdown', 'container_tag_id' => uri_segment(1)))?>
Examples:
<?=fuel_nav(array('group_id' => 'Primary', 'depth' => 1, 'attributes' => 'data-toggle="test"', 'styles' => array('small button')))?>
<?=fuel_nav(array('group_id' => 'Secondary', 'depth' => 1, 'attributes' => 'data-toggle="test"', 'styles' => array('tiny button'))); ?>
No data-toggle="test" appears in the code anywhere. Am I doing something wrong?
Thanks for your help.
<?=fuel_nav(array('group_id' => 'Secondary', 'depth' => 1, 'append' => 'data-toggle="test"', 'styles' => array('tiny button'))); ?>
or
<?=fuel_nav(array('group_id' => 'Secondary', 'depth' => 1, 'append' => array('data-toggle="test"'), 'styles' => array('tiny button'))); ?>
Also, just FYI we're using nav in the db not from the nav file. Not sure if this affects the rest of the discussion above.
Regarding the proper usage of "append" it would be something like the following:
<?php $append = array('my_menu_item' => array('label' => 'My Menu Item', 'parent_id' => 'my_parent_id', 'attributes' => 'data-toggle="test"')); ?> <?=fuel_nav(array('group_id' => 'Secondary', 'depth' => 1, 'append' => $append, 'styles' => array('tiny button'))); ?>
So is this saying that you can only append an attribute to one menu item at a time?