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 automatically become click-to-call links. Loading via content.prepare
will also enable any other content plugin to run on this field.
You can see this in Version 2.6.0 of the code samples.