Allow plugins to handle events regardless of their folder/group location, while maintaining full backward compatibility with the existing group-based system.
The current plugin system constrains event handling based on folder structure, leading to:
A listmonk integration requires:
content
plugin for membership handlinguser
plugin for user deletion cleanupwebservices
plugin for REST API endpointssystem
pluginEnhance the event dispatcher to load plugins based on method availability rather than just folder location.
// Enhanced event dispatcher (simplified)
public function trigger(string $event, array $params = [])
{
$handlers = [];
// Legacy: Load by group (existing behavior)
$handlers = array_merge($handlers, $this->getPluginsByGroup($event));
// New: Load by method availability (new behavior)
$handlers = array_merge($handlers, $this->getPluginsByMethod($event));
// Remove duplicates and execute
$handlers = array_unique($handlers);
return $this->executeHandlers($handlers, $event, $params);
}
private function getPluginsByMethod(string $event): array
{
// Check cached method map or scan enabled plugins
return $this->pluginMethodCache[$event] ?? [];
}
Zero breaking changes:
Introduce optional plugin manifest setting:
<extension type="plugin" group="content">
<!-- Existing attributes -->
<config>
<fields name="params">
<field name="event_discovery" type="list" default="group"
label="Event Discovery Method"
description="How this plugin should be discovered for events">
<option value="group">Group-based (legacy)</option>
<option value="method">Method-based (modern)</option>
<option value="both">Both (maximum compatibility)</option>
</field>
</fields>
</config>
</extension>
This enhancement addresses a fundamental limitation that has grown more problematic as the Joomla plugin ecosystem has matured. It provides a clear migration path toward more logical code organization while respecting the existing ecosystem.
The current system made sense when plugins were simple and few. Today's complex, multi-functional plugins deserve a more flexible architecture that supports developer productivity and maintainable code organization.
Priority: Medium
Complexity: Medium
Breaking Changes: None
Target Version: Joomla 6.x (allows thorough testing and community feedback)
Labels |
Removed:
?
|
Labels |
Added:
No Code Attached Yet
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2025-08-19 12:03:50 |
Closed_By | ⇒ | HLeithner |
I do not agree that you should be able to dump everything for different events in a single plugin for the same reason as you shouldn't abuse the system plugins. There are too many technical/architectural reasons to list why this is a bad idea.
Joomla 6.x reaches feature freeze TODAY so none of this could even be considered until Joomla 7