Joomla - Overriding getItem method

2019-02-14 22:00发布

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条回答
放荡不羁爱自由
2楼-- · 2019-02-14 23:06

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.

查看更多
登录 后发表回答