Support from Acquia helps fund testing for Drupal Acquia logo

Comments

attiks’s picture

Status: Active » Needs review
FileSize
1.93 KB

Attached patch adds a new option so you can output the phone number as a link

attiks’s picture

Still applies, can anybody review?

TommyK’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Still applies. Works great!

pfrenssen’s picture

Status: Reviewed & tested by the community » Needs work

Reviewed the patch, looking good except for a single copy/paste artifact:

+++ b/phone.module
@@ -186,11 +186,48 @@ function phone_field_formatter_info() {
+  // Display this setting only if image is linked.

This is not an "image" field :)

BTMash’s picture

FileSize
1.93 KB

Changed the comment to be a more generic 'field' ;)

BTMash’s picture

Status: Needs work » Needs review
pfrenssen’s picture

Status: Needs review » Reviewed & tested by the community

Great, thanks!

minorOffense’s picture

Status: Reviewed & tested by the community » Needs work

The link display doesn't take into account any extensions which have been applied to the number. You just get one long list of digits.

<a href="tel://888555333345">(888) 555-3333 x45</a>

Based on the spec I think it should read:

<a href="tel://8885553333;ext=45">(888) 555-3333 x45</a>

See http://stackoverflow.com/questions/9838775/problems-using-extensions-in-... for reference.

minorOffense’s picture

Or it could just be a 'p' character. Tough to say.

http://demosthenes.info/blog/536/Adding-Phone-Numbers-To-Web-Pages-With-...

cweaver’s picture

Revised preg_replace for including extensions in telephone links. Based on RFC 3966...

extension = ";ext=" 1*phonedigit"

$text = '<a href="tel://' . preg_replace('/([0-9]+)x([0-9]+)/', '$1;ext=$2', preg_replace('/[^0-9x]/', '', $text)) . '">' . $text . '</a>';
cweaver’s picture

cweaver’s picture

FileSize
1.97 KB

Ignore patch #11. Patch #12 incorporates 1922130.patch and extends it with phone number extension support.

cweaver’s picture

Status: Needs work » Needs review
kruser’s picture

I would suggest a href="sms:// option as well if you wanted to send a Text.

akolahi’s picture

I don't think the two forward slashes are necessary. Simply 'tel:' should suffice, i believe.