Although this can currently be achieved by creating different Phone Number fields, it could be an option for those who needed it. Instead of hardcoding the types (home, work, mobile, fax), configurable options like CCK textfield select options is preferred way to go.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ckng’s picture

arpeggio has been suggested to include hCard microformat support (with phone type selection: Voice, Home, Msg, Work, Pref, Fax, Cell, Video, Pager, BBS, Modem, Car, ISDN, PCS) in [848740].

I'm not familiar with vCard and hCard, perhaps those who has better ideas can chip in the discussion.

  1. Is the phone types fixed?
    According to http://microformats.org/wiki/hcard,
    tel type: VOICE, home, msg, work, pref, fax, cell, video, pager, bbs, modem, car, isdn, pcs
    The list is rather different from usual user requests - home, mobile, work, personal, misc
  2. Do we want to allow user to customize the types?
  3. How will this relates to other modules that already has existing hCard implementation - Addresses, hCard, vCard, other?
arpeggio’s picture

FileSize
440.85 KB

This is an upgrade patch at http://drupal.org/node/865054 supporting hCard microformat. Microformat defined: Voice, Home, Msg, Work, Pref, Fax, Cell, Video, Pager, BBS, Modem, Car, ISDN, PCS. My suggestion is a fixed values as select box because vCard application parsers looked for those specific keywords (case insensitive). You may want to try a vCard application parser of Firefox - the Operator toolbar plugin.

This is not a standalone hCard microformat, this is only a part of the structure of hCard microformat, specifically the tel item. The hCard microformat requires n or fn item to be a complete vCard. Example:

<span class="vcard">
 <span class="fn nickname">arpeggio</span>
  <span class="tel">
   <span class="type">Home</span>&nbsp;
   <a href="tel:+6312345678" class="value">+63 (1) 234-5678</a>
 </span>
</span>

The only part the Phone number module for D7 can generate is:

  <span class="tel">
   <span class="type">Home</span>&nbsp; 
   <a href="tel:+6312345678" class="value">+63 (1) 234-5678</a>
 </span>

The Phone number module for Drupal 7 offers additional field for user's annotation. For example:

  <span class="tel">
   <span class="type">Home</span>&nbsp; 
   <a href="tel:+6312345678" class="value">+63 (1) 234-5678</a>
   <span>Annotation goes here</span>
 </span>
ckng’s picture

Since phone number is just a small puzzle in hCard, have you check out Addresses, hCard or vCard?
We can always output our fragment, but it will make more sense within the hCard block.

The types are fixed, I wonder if it is possible to mask the input with another name. Compare 'mobile' with 'Cell', end user might not get it when they see it. For output we probably can hide the type using CSS.

<div>Mobile: <span class="tel">
<span class="type">Cell</span>
<span> class="value">+44 (0) 1234 56789</span>
</span></div>
ckng’s picture

Version: 6.x-1.0-beta1 » 7.x-1.x-dev
Status: Active » Needs work

Wait for D7 to be ready.

arpeggio’s picture

I have tried Addresses module before. That module is a complete vCard, my comment it has no advance validation/sanitation/formatting for phone number like our Phone number module offers.

Yes, we are already supporting an option to hide the phone type and also supporting annotation which enable the user to add a more descriptive information (like Mobile) about the phone number. These features are all available in that patch.

ckng’s picture

That's why I suggested possible integration with other modules, where Phone number provide them the phone output or pass them the needed data that has been validated/sanitized/formatted.

BenK’s picture

Subscribing

johnv’s picture

subscribe.

CraigBertrand’s picture

Where are we at on this? I really need this for drupal 6.

Is the patch above only for 7?

rooby’s picture

For those who want it in D7, a temporary solution is to use the field_collection module and add your own type field with the phone field in the collection.
I am doing this and it works ok, although isn't probably as good as it would be to have it in the same field.

Drupal 6 people could do a similar thing with cck 6.x-3.x

almaudoh’s picture

When will d7 be ready. I'm interested in using this module for my upcoming d7 project and I'd like to help speed up the development efforts. I can help maintain the module also.

ckng’s picture

I would say the current blocker is #1138024: Token hooks are incorrect for D7, I've no time to work on it ATM.

tmanhollan’s picture

I need the basic functionality for d6. I just need to store a type label with the number, so I did a quick patch to accommodate my needs. It's not as complex as what was originally suggested, but it works for me. Feel free to apply or extend as needed.

This patch:

  • Adds a column to the database to hold the phone type
  • Adds a configuration option to enable the type field (defaults to disabled)
  • If enabled, adds a text field to the input form
  • If enabled and populated, prints the type with the phone number output
  • Adds a few css rules to treat the new field like the others on the input form
Leksat’s picture

Huh... I should found this issue first.
I did the same job: created a patch which adds additional optional field "Comment".
Well... The work is done anyway, so I'm attaching my patch. It mach simpler than from #13, it add just text field. And it for 7.x version

sportel’s picture

A list with selectable phone-types would be very welcome. This is also useful for making proper validation for certain countries. For in the Netherlands, a mobile number always starts with 06-...

Mike.

sportel’s picture

FileSize
35.01 KB
9.75 KB
17.72 KB

I've used the patch from #14 (thanks Leksat) to make a selectlist for selecting the phone number type. It works fine, but since I'm no developer (just used some copy/paste) I'd like to hear from you all if this is properly done, and perhaps there are some suggestions for additional phone number types? Also, I've added the complete module, because I have absolutely no idea how to create a patch file.

See attached pics for the changes.