Quantcast
Channel: Joomla! Forum - community, help and support
Viewing all articles
Browse latest Browse all 1543

Joomla! 5.x Coding • Output your shortcode from the plugin in additional fields

$
0
0
Hi,
I want to output my shortcode from the plugin in additional fields. Unsuccessfully. Maybe there is someone who has encountered this and can tell you?
Here is my plugin code:

Code:

defined('_JEXEC') or die;class PlgContentShortcode extends JPlugin{    protected $autoloadLanguage = true;    public function onContentPrepare($context, &$article, &$params, $limitstart)    {        $replacement1 = $this->replaceMyFunction1();        $replacement2 = $this->replaceMyFunction2();        $article->text = str_replace("[test]", $replacement1, $article->text);        $article->jcFields = str_replace("[test2]", $replacement2, $article->jcFields);        return true;    }    private function replaceMyFunction1()    {        $result = 'Test 1';        return $result;    }        private function replaceMyFunction2()    {        $result = 'Test 2';        return $result;    }}

Statistics: Posted by Brazal — Sat Aug 10, 2024 2:25 pm



Viewing all articles
Browse latest Browse all 1543

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>