Using our click-to-call plugin with this component

As our component displays phone numbers, it would be nice if it could also take advantage of the click-to-call plugin we created earlier. This is very easy to do, we just need to load the phone number via content.prepare so that it will execute any plugin on the output of this field. Edit the default.php view file under /components/com_folio/views/folios/tmpl/ and add the following code:

<?php echo JHTML::_('content.prepare', ' '.$item->phone); ?>

We need to add a space prior to our $item->phone field because our plugin expects to see a phone number within the content, not right at the beginning.

Now as long as the plugin is enabled and the phone numbers are entered in the correct format, they should ...

Get Learning Joomla! 3 Extension Development - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.