From 321f8b84bd3ae4da3d49c09b0de7856a3b6df9b3 Mon Sep 17 00:00:00 2001 From: Jonathan Miller <230051081+jmiller-moko@users.noreply.github.com> Date: Tue, 7 Apr 2026 23:13:49 -0500 Subject: [PATCH] Fix breadcrumbs to respect showHome, showLast, homeText settings Breadcrumbs override now reads module params: showHome controls Home item visibility, homeText sets custom Home label, showLast controls whether the current page appears. Bump to 03.09.09. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/html/mod_breadcrumbs/default.php | 41 ++++++++++++++++++++++++---- src/templateDetails.xml | 2 +- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/src/html/mod_breadcrumbs/default.php b/src/html/mod_breadcrumbs/default.php index fbea28f..96e741e 100644 --- a/src/html/mod_breadcrumbs/default.php +++ b/src/html/mod_breadcrumbs/default.php @@ -10,31 +10,62 @@ /** * Default layout override for mod_breadcrumbs. * Bootstrap 5 breadcrumb with schema.org BreadcrumbList markup. + * Respects showHome, showLast, homeText module settings. */ defined('_JEXEC') or die; use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Uri\Uri; Factory::getApplication()->getLanguage()->load('mod_breadcrumbs', JPATH_SITE); $suffix = htmlspecialchars($params->get('moduleclass_sfx', ''), ENT_COMPAT, 'UTF-8'); $headerTag = htmlspecialchars($params->get('header_tag', 'h3'), ENT_COMPAT, 'UTF-8'); $headerClass = htmlspecialchars($params->get('header_class', ''), ENT_COMPAT, 'UTF-8'); +$showHome = $params->get('showHome', 1); +$showLast = $params->get('showLast', 1); +$homeText = $params->get('homeText', '') ?: Text::_('MOD_BREADCRUMBS_HOME'); + +// Build filtered list respecting module settings +$items = []; +$count = count($list); + +foreach ($list as $key => $item) { + // Skip Home item if showHome is off + if ($key === 0 && !$showHome) { + continue; + } + + // Replace Home text if custom homeText is set + if ($key === 0 && $showHome) { + $item->name = $homeText; + } + + // Skip last item if showLast is off + if ($key === $count - 1 && !$showLast) { + continue; + } + + $items[] = $item; +} + +if (empty($items)) { + return; +} ?>