问题
I want to override the method getItem() found in file \administrator\components\com_content\models\article.php
line 257 public function getItem($pk = null)
I need to modify the return value based on the value of variable $pk.
How do I do this?
I am hoping to find a way to not to modify the core.
Also, if override is possible, can I make a plugin out of it?
Am using Joomla 2.5.9
回答1:
With some more searching, came across a beautiful solution.
All I needed was to override the model (article.php) under com_content. This got it done.
Using the Plugin Override plugin the Joomla core can be overridden. Found a great article on the same on digitaldisseny
The documentation on overriding Joomla! core's MVC using this is here
Hope it helps others too.
Any better ideas are highly welcome.
来源:https://stackoverflow.com/questions/14966202/joomla-overriding-getitem-method