Content Plugins

Official Documentation: https://docs.joomla.org/J3.x:Creating_a_content_plugin

Any active content plugins will parse and potentially modify any content displayed by com_content on the onContentPrepare event during a regular request, but there are lots of events and your plugin can run any code at all.

Plugins run in the order they are in the the admin plugin manager.

Custom HTML modules have a setting to send their content through the content plugins also.

And you can also send content through the content plugins' OnContentPrepare methods from your own code by using:

$text = JHtml::_('content.prepare', $text);

See: https://docs.joomla.org/Triggering_content_plugins_in_your_extension

Content Events

For all events see official doc above.

OnContentPrepare

This is the one you want if you wish to use a shortcode syntax in your articles.

The params

  • context : The context of the content passed to the plugin.
  • article : A reference to the article that is being rendered by the view.
  • params : A reference to an associative array of relevant parameters. The view determines what it considers to be relevant and passes that information along.
  • limitstart : An integer that determines the "page" of the content that is to be generated. Note that in the context of views that might not generate HTML output, a page is a reasonably abstract concept that depends on the context.
function onContentPrepare($context, &$article, &$params, $limitstart)
    {
        //add your plugin codes here
        //no return value
    }