Patch on the way

Files: 
CommentFileSizeAuthor
#5 1922130.patch1.93 KBBTMash
#1 i1922130.patch1.93 KBattiks

Comments

attiks’s picture

Status:Active» Needs review
StatusFileSize
new1.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

StatusFileSize
new1.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"

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