Joomla - Overriding getItem method

我只是一个虾纸丫 提交于 2019-12-19 04:09:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!