-
Notifications
You must be signed in to change notification settings - Fork 233
Active Link Detection
Shea Lewis edited this page Nov 16, 2015
·
1 revision
Caffeinated Menus will actually automatically detect the currently active link for you, based on the current URL. Once an item is detected as being the active link, a new active
class will be attributed to the item. So you will only need to be sure to echo out the item's attributes from within your view (see the documentation on rendering attributes for more information).
The automatic link detection is only useful for one-on-one URI detection. It does not take into consideration of any dynamic URI segments, such as blog/post/edit/1
. For these cases, you may specify that the active state should be activated against other URI segments.
$menu->add('Blog', '#')->active('admin/blog/*');
The above menu item will be active on any URI that matches admin/blog/*
:
admin/blog
admin/blog/create
admin/blog/edit/1
- etc.
- Active Link Detection
- Append and Prepend
- Attributes
- Dividers
- [Meta Data](Meta Data)
- [Sort By](Sort By)