Override core ManageModel from com_installer.

Be informed that this forum is not an official support forum for Joomla! 4.0. Any issues regarding Joomla! 4.0 must be reported at https://issues.joomla.org/.

Joomla! 4.0 is still in its Alpha stage. This forum should be used for sharing information about Joomla! 4.0.

Moderator: ooffick

Post Reply
UWiX
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Wed Feb 24, 2010 7:29 am

Override core ManageModel from com_installer.

Post by UWiX » Fri Mar 29, 2019 8:40 am

I cannot seem to figure out how to override a Model in J!4 - so I hope someone can help me out, here.

What I want to do is log the "publish" state for an Extension which can be toggled in the Extension Manager.
In J!3 this can be done using a system plugin and add the following code to the onAfterRoute() function:

Code: Select all

JLoader::register('InstallerModelManage', JPATH_PLUGINS . '/system/myplugin/overrides/manage.php');
That manage.php file is an exact copy of the manage.php model from the com_installer directory in J!3. It only has a trigger added to it's publish() function. That works perfectly in J!3.

Now I want to accomplish the same for J!4 and did the same with the ManageModel.php file from the com_installer folder. But somehow the JLoader::register isn't enough:

Code: Select all

JLoader::register('ManageModel', JPATH_PLUGINS . '/system/myplugin/overrides/ManageModel.php');
Above code should do the trick - that is in J!3 but not for J!4. I've already remarked the namespace for my override ManageModel.php file (I've read somewhere that is needed).
When I check the loaded ClassList using JLoader::getClassList() I see the override Model is loaded but it isn't used whatsoever.

At this moment I've tried everything from the require_once() to JLoader::import, JLoader::registerNamespace, etc. But nothing seems to load my override Model.

What am I missing here? Does anyone have a suggestion? Thanks!

Post Reply

Return to “Joomla! 4 Related”