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:
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