-
Notifications
You must be signed in to change notification settings - Fork 17
Breadcrumb Navigation
mattsimpson edited this page Dec 16, 2012
·
1 revision
Basic breadcrumb navigation is included in OpenLabyrinth. It is not entirely automated, so you do need to add some code to your controllers in order to get it to work.
Assuming you are creating a new widgetController that has four actions, action_index, action_add, action_edit, and action_delete your controller would look like this:
class Controller_Widget extends Controller_Base {
public function before() {
parent::before();
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('My Widgets'))->set_url(URL::base() . 'widget'));
}
public function action_index() {
}
public function action_add() {
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Add'))->set_url(URL::base() . 'widget/add'));
}
public function action_edit() {
...
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Edit'))->set_url(URL::base() . 'widget/edit/' . $widgetId));
}
public function action_delete() {
...
Breadcrumbs::add(Breadcrumb::factory()->set_title(__('Delete'))->set_url(URL::base() . 'widget/delete/' . $widgetId));
}
...
Please Note how the first My Widgets breadcrumb is in the before method, this is so that regardless of which action you're on "My Widgets" will always be the first crumb (i.e. My Widgets > Add).