I found this page on how to implement a custom field in article:


and it works well, but only in article view.

What should I do else, to make it show that custom field in each article, when in category blog view?

I tried adding :

$dispatcher = JDispatcher::getInstance();
JPluginHelper::importPlugin('content', 'plg_content_rating');
$results = $dispatcher->trigger('onContentPrepare', array('com_content.category', & $this->item, &$this->item->params, 0));

to my category blog override file, but that didn't work.

Also in components/com_content/views/category/view.html.php file, there is a line like this:

$results = $dispatcher->trigger('onContentPrepare', array ('com_content.category', &$item, &$this->params, 0));

Shouldn't that already trigger all registered content plugins?

The similar line in article's view.html.php file, works well for that purpose.

  • Do you mean that you want to display your custom field in the introtext? Commented Oct 27, 2014 at 9:26

1 Answer 1


It depends on your intention.

If you use onContentPrepare to manipulate the markup you need to use the right scope. Your MyPlugin::onContentPrepare will always been fired if the plugin is loaded and a dispatcher triggers "onContentPrepare".

But usually you will check against the scope like

public function onContentPrepare($context, &$row, &$params, $page = 0)
    if (in_array($context, array('com_content.article'))
        return true;

So make sure you use the right scopes.

If you just want to display the custom data within an overwrite, you can simply access it with $item.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.