CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Having a clickable phone number
Pages: [1]

Author Topic: Having a clickable phone number  (Read 660 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Having a clickable phone number
March 20, 2012, 06:57:56 am
Hey,

Request from a customer that has an asterisk PBX: displaying the phone numbers (on contact summary and search results) as a clickable link after some cleaning.

Eg the phone number +44 141 928 042 would be displayed as <a href="tel:0044141928042">+44 141 928 042</a>

What's the best way of doing it?

Was thinking
1) modifying the core to add a new smarty {$contact.phone|phoneNumber} plugin that calls a hook that does the change
or
2) modifying the core to add a <span class="crmt-phone">{$contact.phone}</span> so we can have a .extra that does the formating on the client side

In both ways, can't see how to avoid having to change the core.
Suggestions?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Having a clickable phone number
March 20, 2012, 07:11:24 am

I think for things like phone we need a couple of things to make it useful (IMO).

1. Have a trigger or a hook that stores the phone in  standardized format. This allows non-html pages to render the phone nicely also straight from the DB

2. Adding a specific class to standard objects like: phone, email, address might be a good thing to do in ALL places so external code can manipulate it. So option 2 in your proposal

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Having a clickable phone number
March 20, 2012, 07:57:12 am
for 1) isn't it already possible to "normalise" the phone number on the pre save hook on phone?

(I'm doing something like that for names to avoid all uppercase names and seems to work ok)

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Having a clickable phone number

This forum was archived on 2017-11-26.