EVENT-LIST-001
onContentPrepare / onAfterDispatch / …
Core plugin event names (J3 methods → subscribers)
The event names still fire. The implementation must become a subscriber on native Joomla 6. Search this entry for any onContent*/onUser*/onAfter* method.
onContentPrepare / onAfterDispatch / … → SubscriberInterface::getSubscribedEvents()
Symptoms people search
onContentPrepare not firing · onAfterDispatch · onBeforeCompileHead · onUserLogin · onContentBeforeSave
Replace this code
Swap onContentPrepare / onAfterDispatch / … for SubscriberInterface::getSubscribedEvents().
Joomla 3
Remove or stop calling this
public function onAfterInitialise() {}
public function onAfterRoute() {}
public function onAfterDispatch() {}
public function onBeforeCompileHead() {}
public function onContentPrepare($ctx, &$article, &$params, $page=0) {}
public function onContentAfterTitle(...) {}
public function onContentBeforeDisplay(...) {}
public function onContentAfterDisplay(...) {}
public function onContentPrepareForm($form, $data) {}
public function onContentBeforeSave(...) {}
public function onContentAfterSave(...) {}
public function onContentBeforeDelete(...) {}
public function onContentChangeState(...) {}
public function onUserLogin(...) {}
public function onUserLogout(...) {}
public function onUserAfterSave(...) {}
public function onExtensionAfterInstall(...) {}
public function onDisplay(...) {}Joomla 4 / 6
Use this instead
Map each name in getSubscribedEvents() to a method that receives a typed Event. Do not take &$article by reference.How to fix it
- 1Implement SubscriberInterface.
- 2Register every event you handled as a J3 method.
- 3Read arguments from the Event object.
Also known as
onAfterInitialise · onAfterRoute · onAfterDispatch · onBeforeCompileHead · onAfterRender · onContentPrepare · onContentAfterTitle · onContentBeforeDisplay · onContentAfterDisplay · onContentPrepareForm · onContentBeforeSave · onContentAfterSave · onContentBeforeDelete · onContentChangeState · onUserLogin · onUserLogout · onUserAfterSave · onExtensionAfterInstall · onDisplay
There is no 1:1 swap for this one. The architecture changed. If you cannot rewrite it, Infyways can.
Related issues
- Joomla 3 → 4Joomla API
JError / JException
JError::raiseError() → throw new RuntimeException() / try-catch
- Joomla 3 → 4Events / plugins
JDispatcher / JEventDispatcher
JDispatcher::getInstance() → Event dispatcher + SubscriberInterface
- Joomla 3 → 4PHP
each() / create_function() / ereg / split
each($array) → foreach / closures / preg_*
- Joomla 5 → 6Events / plugins
JPlugin onX methods vs SubscriberInterface
function onContentPrepare(...) → CMSPlugin + SubscriberInterface::getSubscribedEvents()
- Joomla 3 → 4PHP
eval() in extensions
eval($code) → Never — forbidden for Infyways work
- Joomla 3 → 4Events / plugins
onAfterRender HTML string hacks
onAfterRender() { $body = JResponse::getBody(); } → Document events / WebAssetManager