Simplify component.php to minimal layout with conditional analytics #82

Merged
Copilot merged 78 commits from copilot/fix-breaking-overrides into main 2026-03-17 21:42:02 +00:00
11 changed files with 57 additions and 387 deletions
Showing only changes of commit 077ed5fd43 - Show all commits

View File

@@ -19,6 +19,52 @@ All notable changes to the MokoCassiopeia Joomla template are documented in this
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [03.08.02] - 2026-02-27
### Removed - Fix Language Loading in All Module Overrides
**Critical fix**: Removed standard Joomla module overrides to fix language string loading issues. Following Cassiopeia template approach.
#### Problem
- Default language strings not loading in module overrides (mod_breadcrumbs, mod_login, mod_articles_latest)
- Language constants displayed instead of translated text (e.g., "MOD_LOGIN_VALUE_USERNAME" instead of "Username")
- Custom overrides interfered with Joomla's module initialization and language loading process
#### Solution - Cassiopeia Approach
- **Removed** standard Joomla module overrides:
- `src/templates/html/mod_breadcrumbs/` (2 files)
- `src/templates/html/mod_login/` (2 files)
- `src/templates/html/mod_articles_latest/` (2 files)
- Template now uses Joomla's core module layouts for standard modules
- Language files load automatically via Joomla's module system
- Custom styling can still be applied via CSS using module-specific classes
- **Retained** third-party extension overrides where they add mobile-responsive value:
- VirtueMart modules (5): mod_virtuemart_cart, _category, _currencies, _manufacturer, _product
- Community Builder modules (2): mod_cblogin, mod_comprofilerOnline
- Other extensions (9): mod_acymailing, mod_hikashop_cart, mod_k2_content, mod_kunena*, mod_osmembership, mod_search
#### Cassiopeia Template Philosophy
- Cassiopeia (Joomla's default template) does NOT override standard module layouts
- It relies on core Joomla module files and applies styling via CSS
- Overrides are only created when structural changes are absolutely necessary
- This ensures compatibility, automatic language loading, and easier maintenance
#### Module Count Update
- **Before**: 19 module overrides
- **After**: 16 module overrides
- **Removed**: 3 standard Joomla modules (breadcrumbs, login, articles_latest)
- **Component overrides**: Still 7 (unchanged)
#### Files Removed
- `src/templates/html/mod_breadcrumbs/default.php`
- `src/templates/html/mod_breadcrumbs/index.html`
- `src/templates/html/mod_login/default.php`
- `src/templates/html/mod_login/index.html`
- `src/templates/html/mod_articles_latest/default.php`
- `src/templates/html/mod_articles_latest/index.html`
**Note**: This follows Joomla best practices by using core layouts for standard modules. Styling is handled via CSS. Third-party extension overrides remain for mobile responsiveness.
## [03.08.01] - 2026-02-27 ## [03.08.01] - 2026-02-27
### Removed - Fix Breaking Overrides ### Removed - Fix Breaking Overrides

View File

@@ -24,7 +24,7 @@
INGROUP: MokoCassiopeia.Documentation INGROUP: MokoCassiopeia.Documentation
REPO: https://github.com/mokoconsulting-tech/MokoCassiopeia REPO: https://github.com/mokoconsulting-tech/MokoCassiopeia
FILE: docs/MODULE_OVERRIDES.md FILE: docs/MODULE_OVERRIDES.md
VERSION: 03.08.01 VERSION: 03.08.02
BRIEF: Comprehensive guide to MokoCassiopeia mobile-responsive module overrides BRIEF: Comprehensive guide to MokoCassiopeia mobile-responsive module overrides
PATH: /docs/MODULE_OVERRIDES.md PATH: /docs/MODULE_OVERRIDES.md
--> -->
@@ -35,7 +35,9 @@ This document provides a comprehensive guide to all mobile-responsive module and
## Overview ## Overview
MokoCassiopeia includes **19 mobile-responsive module overrides** and **7 component view overrides** designed to enhance the mobile user experience across standard Joomla, VirtueMart, Community Builder, and popular third-party extensions. MokoCassiopeia includes **16 mobile-responsive module overrides** and **7 component view overrides** designed to enhance the mobile user experience for third-party extensions (VirtueMart, Community Builder, Kunena, etc.).
**Important**: Following Cassiopeia template best practices, MokoCassiopeia does NOT override standard Joomla core modules (mod_breadcrumbs, mod_login, mod_articles_latest, etc.). These use Joomla's default layouts to ensure proper language loading and compatibility.
### Key Features ### Key Features

View File

@@ -1,42 +1,13 @@
# Standard Joomla & Community Builder Module Mobile Responsive Overrides # Standard Joomla & Community Builder Module Mobile Responsive Overrides
## Overview ## Overview
This directory contains mobile-responsive overrides for standard Joomla and Community Builder modules, designed specifically for the MokoCassiopeia template. This directory contains mobile-responsive overrides for Community Builder modules, designed specifically for the MokoCassiopeia template.
**Note**: The mod_menu override has been removed to prevent conflicts with Joomla's core menu system. Use Joomla's default menu rendering or apply custom CSS to the `.mod-menu` class for styling. **Important**: Following Cassiopeia template best practices, standard Joomla core modules (mod_breadcrumbs, mod_login, mod_articles_latest, mod_menu) are NOT overridden. These use Joomla's default layouts to ensure proper language loading and compatibility. Apply custom styling via CSS.
## Standard Joomla Modules
### 1. mod_breadcrumbs
Breadcrumb navigation module featuring:
- Schema.org structured data
- Responsive breadcrumb trail
- Home icon support
- Active page highlighting
- Touch-friendly links
### 2. mod_login
User login form module with:
- Login and logout states
- Two-factor authentication support
- Remember me functionality
- Password recovery links
- User registration links
- Touch-friendly form inputs (48px on mobile)
- 16px input font (prevents iOS zoom)
### 3. mod_articles_latest
Latest articles display module offering:
- Responsive article cards
- Optional metadata display (author, date, category, hits)
- Schema.org Article markup
- Introtext support
- Read more links
- Touch-friendly interactions
## Community Builder Modules ## Community Builder Modules
### 4. mod_cblogin ### 1. mod_cblogin
Community Builder login module with: Community Builder login module with:
- Avatar display in logged-in state - Avatar display in logged-in state
- Profile link button - Profile link button
@@ -46,7 +17,7 @@ Community Builder login module with:
- Registration link - Registration link
- Pre/post text support - Pre/post text support
### 5. mod_comprofilerOnline ### 2. mod_comprofilerOnline
Community Builder online users module featuring: Community Builder online users module featuring:
- Online user count display - Online user count display
- Members vs. guests breakdown - Members vs. guests breakdown

View File

@@ -1,105 +0,0 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_latest
*
* @copyright (C) 2025 Moko Consulting <hello@mokoconsulting.tech>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* Mobile responsive override for mod_articles_latest module
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
// Ensure module language file is loaded
$lang = Factory::getLanguage();
$lang->load('mod_articles_latest', JPATH_SITE);
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx', ''), ENT_COMPAT, 'UTF-8');
// Add responsive wrapper class
$wrapperClass = 'mod-articles-latest mod-articles-latest-responsive ' . $moduleclass_sfx;
?>
<div class="<?php echo $wrapperClass; ?>">
<?php if (!empty($list)) : ?>
<ul class="mod-articles-latest__list">
<?php foreach ($list as $item) : ?>
<li class="mod-articles-latest__item" itemscope itemtype="https://schema.org/Article">
<?php if ($params->get('show_introtext', 0) && !empty($item->introtext)) : ?>
<div class="mod-articles-latest__article">
<h<?php echo $params->get('item_heading', 4); ?> class="mod-articles-latest__title" itemprop="headline">
<?php if ($params->get('link_titles', 1)) : ?>
<a href="<?php echo $item->link; ?>" itemprop="url" class="mod-articles-latest__link">
<?php echo htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8'); ?>
</a>
<?php else : ?>
<?php echo htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8'); ?>
<?php endif; ?>
</h<?php echo $params->get('item_heading', 4); ?>>
<?php if ($params->get('show_author', 0) || $params->get('show_date', 0) || $params->get('show_category', 0) || $params->get('show_hits', 0)) : ?>
<div class="mod-articles-latest__meta">
<?php if ($params->get('show_author', 0)) : ?>
<span class="mod-articles-latest__author" itemprop="author" itemscope itemtype="https://schema.org/Person">
<span class="icon-user" aria-hidden="true"></span>
<span itemprop="name"><?php echo $item->author; ?></span>
</span>
<?php endif; ?>
<?php if ($params->get('show_date', 0)) : ?>
<span class="mod-articles-latest__date">
<span class="icon-calendar" aria-hidden="true"></span>
<time datetime="<?php echo HTMLHelper::_('date', $item->publish_up, 'c'); ?>" itemprop="datePublished">
<?php echo HTMLHelper::_('date', $item->publish_up, Text::_('DATE_FORMAT_LC3')); ?>
</time>
</span>
<?php endif; ?>
<?php if ($params->get('show_category', 0)) : ?>
<span class="mod-articles-latest__category">
<span class="icon-folder" aria-hidden="true"></span>
<?php echo $item->displayCategoryTitle; ?>
</span>
<?php endif; ?>
<?php if ($params->get('show_hits', 0)) : ?>
<span class="mod-articles-latest__hits">
<span class="icon-eye" aria-hidden="true"></span>
<?php echo $item->displayHits; ?>
</span>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="mod-articles-latest__intro" itemprop="description">
<?php echo $item->introtext; ?>
</div>
<?php if ($params->get('readmore', 0)) : ?>
<div class="mod-articles-latest__readmore">
<a href="<?php echo $item->link; ?>" class="mod-articles-latest__readmore-link btn btn-secondary">
<?php echo Text::_('MOD_ARTICLES_LATEST_READMORE'); ?>
<span class="icon-chevron-right" aria-hidden="true"></span>
</a>
</div>
<?php endif; ?>
</div>
<?php else : ?>
<a href="<?php echo $item->link; ?>" class="mod-articles-latest__link" itemprop="url">
<span itemprop="headline"><?php echo htmlspecialchars($item->title, ENT_COMPAT, 'UTF-8'); ?></span>
</a>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<?php else : ?>
<div class="mod-articles-latest__empty">
<p><?php echo Text::_('MOD_ARTICLES_LATEST_NO_ARTICLES'); ?></p>
</div>
<?php endif; ?>
</div>

View File

@@ -1 +0,0 @@
<!DOCTYPE html><html><head><title></title></head><body></body></html>

View File

@@ -1,68 +0,0 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_breadcrumbs
*
* @copyright (C) 2025 Moko Consulting <hello@mokoconsulting.tech>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* Mobile responsive override for mod_breadcrumbs module
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
// Ensure module language file is loaded
$lang = Factory::getLanguage();
$lang->load('mod_breadcrumbs', JPATH_SITE);
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx', ''), ENT_COMPAT, 'UTF-8');
// Add responsive wrapper class
$wrapperClass = 'mod-breadcrumbs mod-breadcrumbs-responsive ' . $moduleclass_sfx;
?>
<nav class="<?php echo $wrapperClass; ?>" aria-label="<?php echo Text::_('JGLOBAL_YOU_ARE_HERE'); ?>">
<?php if ($params->get('showHereYouAre', 1)) : ?>
<span class="mod-breadcrumbs__prefix"><?php echo Text::_('JGLOBAL_YOU_ARE_HERE'); ?>:</span>
<?php endif; ?>
<ol class="mod-breadcrumbs__list" itemscope itemtype="https://schema.org/BreadcrumbList">
<?php if ($params->get('showHome', 1)) : ?>
<li class="mod-breadcrumbs__item mod-breadcrumbs__item--home" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
<?php $icon = $params->get('homeIcon', 'icon-home'); ?>
<a itemprop="item" href="<?php echo $list[0]->link; ?>" class="mod-breadcrumbs__link">
<span class="<?php echo $icon; ?>" aria-hidden="true"></span>
<span itemprop="name" class="visually-hidden"><?php echo htmlspecialchars($list[0]->name, ENT_COMPAT, 'UTF-8'); ?></span>
</a>
<meta itemprop="position" content="1" />
</li>
<?php $position = 2; ?>
<?php else : ?>
<?php $position = 1; ?>
<?php endif; ?>
<?php
$start = $params->get('showHome', 1) ? 1 : 0;
$count = count($list);
for ($i = $start; $i < $count; $i++) :
$isLast = ($i === $count - 1);
?>
<li class="mod-breadcrumbs__item <?php echo $isLast ? 'mod-breadcrumbs__item--active' : ''; ?>" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
<?php if (!$isLast) : ?>
<a itemprop="item" href="<?php echo $list[$i]->link; ?>" class="mod-breadcrumbs__link">
<span itemprop="name"><?php echo htmlspecialchars($list[$i]->name, ENT_COMPAT, 'UTF-8'); ?></span>
</a>
<?php else : ?>
<span itemprop="name" class="mod-breadcrumbs__current" aria-current="page">
<?php echo htmlspecialchars($list[$i]->name, ENT_COMPAT, 'UTF-8'); ?>
</span>
<?php endif; ?>
<meta itemprop="position" content="<?php echo $position++; ?>" />
</li>
<?php endfor; ?>
</ol>
</nav>

View File

@@ -1 +0,0 @@
<!DOCTYPE html><html><head><title></title></head><body></body></html>

View File

@@ -1,173 +0,0 @@
<?php
/**
* @package Joomla.Site
* @subpackage mod_login
*
* @copyright (C) 2025 Moko Consulting <hello@mokoconsulting.tech>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*
* Mobile responsive override for mod_login module
*/
defined('_JEXEC') or die;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
// Ensure module language file is loaded
$lang = Factory::getLanguage();
$lang->load('mod_login', JPATH_SITE);
HTMLHelper::_('behavior.keepalive');
HTMLHelper::_('bootstrap.tooltip', '.hasTooltip');
$usersConfig = ComponentHelper::getParams('com_users');
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx', ''), ENT_COMPAT, 'UTF-8');
// Add responsive wrapper class
$wrapperClass = 'mod-login mod-login-responsive ' . $moduleclass_sfx;
?>
<div class="<?php echo $wrapperClass; ?>">
<?php if ($type === 'logout') : ?>
<form action="<?php echo Route::_('index.php', true); ?>" method="post" id="login-form-<?php echo $module->id; ?>" class="mod-login__form mod-login__form--logout">
<?php if ($params->get('greeting', 1)) : ?>
<div class="mod-login__greeting">
<?php if ($params->get('name', 0) == 0) : ?>
<?php echo Text::sprintf('MOD_LOGIN_HINAME', htmlspecialchars($user->get('name'), ENT_COMPAT, 'UTF-8')); ?>
<?php else : ?>
<?php echo Text::sprintf('MOD_LOGIN_HINAME', htmlspecialchars($user->get('username'), ENT_COMPAT, 'UTF-8')); ?>
<?php endif; ?>
</div>
<?php endif; ?>
<div class="mod-login__actions">
<button type="submit" name="Submit" class="mod-login__btn mod-login__btn--logout btn btn-secondary">
<span class="icon-sign-out" aria-hidden="true"></span>
<?php echo Text::_('JLOGOUT'); ?>
</button>
<input type="hidden" name="option" value="com_users" />
<input type="hidden" name="task" value="user.logout" />
<input type="hidden" name="return" value="<?php echo $return; ?>" />
<?php echo HTMLHelper::_('form.token'); ?>
</div>
</form>
<?php else : ?>
<form action="<?php echo Route::_('index.php', true); ?>" method="post" id="login-form-<?php echo $module->id; ?>" class="mod-login__form mod-login__form--login">
<?php if ($params->get('pretext')) : ?>
<div class="mod-login__pretext">
<?php echo $params->get('pretext'); ?>
</div>
<?php endif; ?>
<div class="mod-login__fields">
<div class="mod-login__field">
<label for="modloginusername-<?php echo $module->id; ?>" class="mod-login__label">
<?php echo Text::_('MOD_LOGIN_VALUE_USERNAME'); ?>
</label>
<input
id="modloginusername-<?php echo $module->id; ?>"
type="text"
name="username"
class="mod-login__input form-control"
placeholder="<?php echo Text::_('MOD_LOGIN_VALUE_USERNAME'); ?>"
autocomplete="username"
required
/>
</div>
<div class="mod-login__field">
<label for="modloginpass-<?php echo $module->id; ?>" class="mod-login__label">
<?php echo Text::_('JGLOBAL_PASSWORD'); ?>
</label>
<input
id="modloginpass-<?php echo $module->id; ?>"
type="password"
name="password"
class="mod-login__input form-control"
placeholder="<?php echo Text::_('JGLOBAL_PASSWORD'); ?>"
autocomplete="current-password"
required
/>
</div>
<?php if (count($twofactormethods) > 1) : ?>
<div class="mod-login__field">
<label for="modloginsecretkey-<?php echo $module->id; ?>" class="mod-login__label">
<?php echo Text::_('JGLOBAL_SECRETKEY'); ?>
</label>
<input
id="modloginsecretkey-<?php echo $module->id; ?>"
type="text"
name="secretkey"
class="mod-login__input form-control"
placeholder="<?php echo Text::_('JGLOBAL_SECRETKEY'); ?>"
autocomplete="one-time-code"
/>
</div>
<?php endif; ?>
<?php if ($params->get('useLocale', 0)) : ?>
<div class="mod-login__field">
<label for="lang-<?php echo $module->id; ?>" class="mod-login__label">
<?php echo Text::_('MOD_LOGIN_LANGUAGE'); ?>
</label>
<?php echo $languages; ?>
</div>
<?php endif; ?>
<?php if ($params->get('showRememberMe', 1)) : ?>
<div class="mod-login__remember">
<input
id="modloginrememberme-<?php echo $module->id; ?>"
type="checkbox"
name="remember"
class="mod-login__checkbox"
value="yes"
/>
<label for="modloginrememberme-<?php echo $module->id; ?>" class="mod-login__remember-label">
<?php echo Text::_('MOD_LOGIN_REMEMBER_ME'); ?>
</label>
</div>
<?php endif; ?>
</div>
<div class="mod-login__actions">
<button type="submit" name="Submit" class="mod-login__btn mod-login__btn--submit btn btn-primary">
<span class="icon-sign-in" aria-hidden="true"></span>
<?php echo Text::_('JLOGIN'); ?>
</button>
<input type="hidden" name="option" value="com_users" />
<input type="hidden" name="task" value="user.login" />
<input type="hidden" name="return" value="<?php echo $return; ?>" />
<?php echo HTMLHelper::_('form.token'); ?>
</div>
<?php if ($usersConfig->get('allowUserRegistration')) : ?>
<div class="mod-login__links">
<a href="<?php echo Route::_('index.php?option=com_users&view=registration'); ?>" class="mod-login__link">
<?php echo Text::_('MOD_LOGIN_REGISTER'); ?>
<span class="icon-chevron-right" aria-hidden="true"></span>
</a>
<a href="<?php echo Route::_('index.php?option=com_users&view=reset'); ?>" class="mod-login__link">
<?php echo Text::_('MOD_LOGIN_FORGOT_YOUR_PASSWORD'); ?>
<span class="icon-chevron-right" aria-hidden="true"></span>
</a>
<a href="<?php echo Route::_('index.php?option=com_users&view=remind'); ?>" class="mod-login__link">
<?php echo Text::_('MOD_LOGIN_FORGOT_YOUR_USERNAME'); ?>
<span class="icon-chevron-right" aria-hidden="true"></span>
</a>
</div>
<?php endif; ?>
<?php if ($params->get('posttext')) : ?>
<div class="mod-login__posttext">
<?php echo $params->get('posttext'); ?>
</div>
<?php endif; ?>
</form>
<?php endif; ?>
</div>

View File

@@ -1 +0,0 @@
<!DOCTYPE html><html><head><title></title></head><body></body></html>

View File

@@ -36,7 +36,7 @@
</server> </server>
</updateservers> </updateservers>
<name>MokoCassiopeia</name> <name>MokoCassiopeia</name>
<version>03.08.01</version> <version>03.08.02</version>
<creationDate>2026-02-27</creationDate> <creationDate>2026-02-27</creationDate>
<author>Jonathan Miller || Moko Consulting</author> <author>Jonathan Miller || Moko Consulting</author>
<authorEmail>hello@mokoconsulting.tech</authorEmail> <authorEmail>hello@mokoconsulting.tech</authorEmail>

View File

@@ -24,7 +24,7 @@
INGROUP: MokoCassiopeia INGROUP: MokoCassiopeia
REPO: https://github.com/mokoconsulting-tech/MokoCassiopeia REPO: https://github.com/mokoconsulting-tech/MokoCassiopeia
PATH: ./updates.xml PATH: ./updates.xml
VERSION: 03.08.01 VERSION: 03.08.02
BRIEF: Update manifest XML file for MokoCassiopeia BRIEF: Update manifest XML file for MokoCassiopeia
--> -->
@@ -36,7 +36,7 @@
<type>template</type> <type>template</type>
<client>site</client> <client>site</client>
<version>03.08.01</version> <version>03.08.02</version>
<creationDate>2026-02-27</creationDate> <creationDate>2026-02-27</creationDate>
<author>Jonathan Miller || Moko Consulting</author> <author>Jonathan Miller || Moko Consulting</author>
<authorEmail>hello@mokoconsulting.tech</authorEmail> <authorEmail>hello@mokoconsulting.tech</authorEmail>