J6.1 plugin constructor: drop DispatcherInterface arg (deprecation)#12
Merged
Conversation
Joomla 6.1 (released 2026-04-14) deprecates the DispatcherInterface
parameter on CMSPlugin::__construct. Old-style two-arg calls still
work but emit E_USER_DEPRECATED and will be removed in J7.0.
Verified against:
- joomla-cms PR #46683 ("[6.1] Remove use of deprecated dispatcher
from the plugin constructor")
- libraries/src/Plugin/CMSPlugin.php on 6.1-dev (constructor now
takes only $config; instanceof DispatcherInterface check is the
legacy compat path that triggers the deprecation)
- plugins/captcha/powcaptcha/services/provider.php on 6.1-dev
(single-arg instantiation, then ->setApplication(...))
Edits:
- references/plugin.md service-provider example: drop the
DispatcherInterface import and the $container->get() lookup;
instantiate with just (array) PluginHelper::getPlugin($group,
$element). Added a "Joomla 6.0 / 6.1 / 7.0" callout that quotes
the deprecation message verbatim, links the 6.1-dev source, and
documents the legacy two-arg form for J5/J6.0 backward compat
with the trade-off spelled out.
- references/plugin.md plugin class example: remove the now-dead
use Joomla\Event\DispatcherInterface; — only ever there for the
old constructor's typed parameter.
- references/service-provider.md plugin-row in the "what each
extension type registers" table: plugins use no
Service\Provider\* factory shorthand; the provider just news the
class with $config. Added the J6.0 → J6.1+ deprecation note
pointing at plugin.md for full details.
Captured in CHANGELOG [Unreleased] § Fixed.
Issue #11 is the coordination point for the rest of the J6.1
sweep (branch names in canonical sources, <targetplatform>
regexes, new-feature coverage).
This was referenced Apr 30, 2026
bcordis
added a commit
that referenced
this pull request
Apr 30, 2026
… verification (#13) Closes #3. - Cross-references to all four shared refs added (manifest, language-files, service-provider, install-script). New Language Files section, new Install Script (Optional) section, intros on Manifest XML and Service Provider. - Web Asset Manager registration subsection inside Dispatcher (useStyle/ useScript against joomla.asset.json, Text::script() registration). - Caching section (default per-instance keying, URL- and session-state edge cases, no dispatcher-level public cache-key hook). - Joomla 6.1 capabilities section (Versions for Modules / UCM history, #__extensions.custom_data column). - Verified AbstractModuleDispatcher and mod_articles_news provider against joomla-cms 6.1-dev — both unchanged for 6.1; permalinks captured. - Module dispatchers don't extend CMSPlugin, so the J6.1 plugin-constructor deprecation (#12) does not affect modules. CHANGELOG [Unreleased] updated under issue #3 audit subsection.
This was referenced Apr 30, 2026
bcordis
added a commit
that referenced
this pull request
Apr 30, 2026
…oloadLanguage, pitfalls, J6.1 verify (#14) Closes #4. Bug fixes: - Manifest <language> path was en-GB/plg_content_example.ini (legacy admin-installed naming). Fixed to en-GB/en-GB.plg_content_example.ini (locale-prefixed source-tree naming) per language-files.md. Added the missing .sys.ini line — most plugins ship both runtime and .sys.ini. - Plugin class example now declares protected $autoloadLanguage = true; Without it, runtime PLG_* keys render as raw strings. Cross-references to shared refs (cross-cutting principle from #2): - Manifest XML and Service Provider sections get cross-link intros. - New Language Files section: PLG_<GROUP>_<ELEMENT>_*, locale-prefix rule, $autoloadLanguage requirement, task-plugin _TITLE/_DESC suffix rule. - New Install Script (Optional) section pointer to install-script.md. New Common Pitfalls section covering seven highest-frequency plugin install/load failure modes. J6.1 verification (continuous): - getSubscribedEvents() shape verified against plg_content_pagebreak on 6.1-dev — string event-name keys, no class constants. - ContentEvent abstract base on 6.1-dev confirmed to deliberately NOT define ON_* constants. Typed event classes (ContentPrepareEvent etc.) exist only as handler-parameter types, not as keys for getSubscribedEvents(). - Initial audit flagged events-as-strings as drift; upstream verification shows the skill's pattern matches core. Docblock added explaining the distinction. Dispatcher-constructor change from PR #12 unchanged — that callout was already correct. CHANGELOG [Unreleased] updated under issue #4 audit subsection.
This was referenced Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tracks #11. Updates
references/plugin.mdandreferences/service-provider.mdfor the Joomla 6.1CMSPlugin::__constructchange.Background
Joomla 6.1 (released 2026-04-14) deprecates passing a
DispatcherInterfaceto the plugin constructor:— from
libraries/src/Plugin/CMSPlugin.phpon6.1-dev, tracked in PR #46683.The skill's previous example (still on
developuntil this PR lands) instantiated plugins asnew Example($dispatcher, $config)— that form now emitsE_USER_DEPRECATEDon every plugin load on 6.1+, and breaks outright in 7.0.What changed
references/plugin.mdservice-provider example — single-arg instantiation, noDispatcherInterfaceimport or container lookup. Matches theplg_captcha_powcaptchareference plugin in core.references/plugin.mdquoting the deprecation message, citing the source permalink, documenting the legacy two-arg form for J5/J6.0 backward compat, and explaining what to do if a plugin actually needs to dispatch its own events (implementDispatcherAwareInterfacedirectly;CMSPluginwon't provide that wiring in 7.0).references/plugin.mdplugin class — removed the deaduse Joomla\Event\DispatcherInterface;import (only ever there for the old constructor's typed parameter).references/service-provider.md— plugin row in the per-type registration table updated: plugins use noService\Provider\*factory shorthand; the provider justnews the class with$config. Forward-pointer toplugin.mdfor the full deprecation story.What I deliberately did NOT do
module.md— it was not affected by #46683. Module dispatchers aren'tCMSPlugin.Test plan
bash scripts/validate.shpasses.joomla-cms6.1-devsource:CMSPlugin::__construct($config = [])accepts the single-arg form cleanly; theinstanceof DispatcherInterfacecheck is only the deprecation path for legacy callers.plg_captcha_powcaptchaprovider in core — same pattern.validate.ymlworkflow green.Generated by Claude Code