I am new to joomla. I am trying to learn some extension development. I already have experience in WordPress themes and plugins. I want to filter a phone number in an article and show it in a appropriate manner. For this I have written test plugin code, but it is not filtering. I have even tried to put an exit statement in the onContentPrepare() hook but it is not working.
/**
* @package Joomla.Plugin
* @subpackage Content.ClicktoCall
* @since 3.0
* @version 1.0.0
*/
defined('_JEXEC') or die;
jimport('joomla.plugin.plugin');
class eqlContentClicktoCall extends JPlugin {
public function onContentPrepare($context, &$row, &$params, $page = 0) {
// Don't run this plugin when the content is being indexed
exit();
if ($context == 'com_finder.indexer') {
return true;
}
if (is_object($row)) {
return $this->clicktocall($row->text, $params);
}
return $this->clicktocall($row);
}
protected function clicktocall(&$text) {
$pattern = '/(\d{4})(\d{3})(\d{4})/';
$replace = "+92-$1-$2-$3";
$text=preg_replace($pattern, $replace, $text);
return true;
}
}
How can I get this hook to work?
exit();? - Lodder