Breadcrumb navigation
Breadcrumb navigation, an unobtrusive but useful part of online applications, is not to be missed in Jet. Again, of course, this is not a view (although it is part of the sample application in the UI.Admin and UI.Web modules), but an abstraction of breadcrumb navigation, so from an MVC perspective it is a model.
The breadcrumb navigation model consists of two classes:
- Jet\Navigation_Breadcrumb
The main class, representing the navigation as such, holds the list of items and allows you to operate on them. - Jet\Navigation_Breadcrumb_Item
A class representing a breadcrumb navigation item.
Breadcrumb navigation primarily works with Jet MVC, but it can be used on its own without binding to MVC. In this case, the navigation must be set using the Navigation_Breadcrumb::set method. However, by default, breadcrumb navigation is automatically set according to the current page (of course, you can influence the navigation settings in any way you like).
Even if you have full control over the navigation (see references of both classes), the most common operation is adding an item. For example, in the article administration (within the sample application) in the controller you will find this:
Navigation_Breadcrumb::addURL( Tr::_( 'Edit article <b>%TITLE%</b>', ['TITLE' => $article->getTitle()] ) );
As already mentioned, the navigation is only a model. How it is displayed is entirely up to you. The following examples are available in the sample application:
- ~/application/modules/UI/Admin/views/breadcrumb_navigation.phtml
- ~/application/modules/UI/Web/views/breadcrumb-navigation/default.phtml
- ~/application/modules/UI/Web/views/breadcrumb-navigation/secret.phtml