PHP
Joomla! 6
Joomla! 5
Joomla! 3 (Legacy)
Component
Basic
Add Custom Items to the Joomla Breadcrumb (Pathway)
Appends intermediate category links and the current item title to mod_breadcrumbs using $app->getPathway()->addItem().
components/com_example/src/View/Item/HtmlView.php
<?php
declare(strict_types=1);
use Joomla\CMS\Factory;
use Joomla\CMS\Router\Route;
$pathway = Factory::getApplication()->getPathway();
$pathway->addItem(
(string) $this->item->category_title,
Route::_('index.php?option=com_example&view=items&catid=' . (int) $this->item->catid)
);
$pathway->addItem((string) $this->item->title);
Call inside HtmlView::prepareDocument() before rendering output.
components/com_example/src/View/Item/HtmlView.php
<?php
$pathway = JFactory::getApplication()->getPathway();
$pathway->addItem($this->item->category_title, JRoute::_('index.php?option=com_example&catid=' . $this->item->catid));
$pathway->addItem($this->item->title);
Legacy Joomla 3 usage with JFactory::getApplication()->getPathway().
Technical explanation and best practices
Inside custom components and detail views, updating the Joomla Pathway ensures both mod_breadcrumbs and BreadcrumbList schema reflect the exact hierarchy.