Breadcrumbs
Reusable Bootstrap 5.3 breadcrumb navigation generated from the current application URI.
Category
Navigation
Implementation
shared/apps/navigation/breadcrumbs/src/Breadcrumbs.php
How it works
The Core App reads the context-relative URI slug, splits it into path segments and builds a breadcrumb trail with cumulative links. The final entry represents the current page and is marked as active. The context root is used for the Home link.
For example, core/apps/navigation/breadcrumbs produces the hierarchy Home / Core /
Apps
/ Navigation / Breadcrumbs before application-specific titles are applied.
Breadcrumb titles are independent of sidebar configuration. Unknown slugs are converted into readable titles automatically.
Available methods
__invoke(), getTranslations(), prepareBreadcrumbs(), formatSlug(),
getHomeTitle(), getBaseTemplate()
These methods describe the Core App's rendering and customization flow. Check their visibility and the current implementation before overriding them.
Application-specific titles
The shared Core App returns an empty translation map by default. Applications can override getTranslations()
in a class extension to provide custom labels. The default lookup uses individual URI segments; exact
context-relative path mappings require a matching prepareBreadcrumbs() override. The
application can also override prepareBreadcrumbs() to resolve exact cumulative paths,
distinguishing identical segment names used in different sections.
protected function getTranslations(): array
{
return [
'core' => 'Core',
'core/apps' => 'Core Apps',
'core/apps/navigation' => 'Navigation',
'core/apps/navigation/breadcrumbs' => 'Breadcrumbs',
];
}
For cumulative path keys like those above, override prepareBreadcrumbs() to apply each path
to
the corresponding item. The Home label can be customized separately through getHomeTitle()
if
supported by the installed Core App version.
Integration
Assign the Breadcrumbs Core App to the required URI or application layout. The application controls where the rendered output is placed; for example, a class extension can append it to a dedicated view slot that is rendered before the page content.
When using a view slot, ensure the Breadcrumbs Core App runs before the component that reads that slot. Intermediate breadcrumb links should point to valid routes in the application.
Bootstrap 5.3 styling must be available in the consuming application. The Core App does not depend on the documentation sidebar.