Introduction

This module provides a HTML5 phone field that supports the tel: schema that is available on most recent smart-phones.

The HTML5 tel: schema is defined in 2004, in RFC3966: The tel URI for Telephone Numbers. For an update, see Geoff Graham: The Current State of Telephone Links .

Using the module

After the module has been enabled, a Phone number field becomes available and may be added to an entity bundle. When you do, a form for setting up the field (like the one shown below) appears.

phonefield.png
Form for setting up the phone field

A phone link label (e.g. “Call us”) for can be set to static, optional, or no label. If the label is optional, there will be a translatable field for the label along with phone number field on each entity instance. If the label is static, the phone link will always use the same label. The static or default label is entered on the form for editing the phone field settings for a particular entity. A static or default label cannot be translated.

The module provides four format options that can be selected in the column “Format” under the “Manage display” tab.

  1. Phone link (default): A phone link with the label used as anchor text.
  2. Label: phone link: The label is followed by a phone link with the phone number as anchor text.
  3. Label: phone number: The label is followed by the phone number (no link).
  4. Phone number: Only the phone number (no label, no link).

If hook_phonefield__supports_tel() is implemented, and it returns FALSE, a link will not be created, even if a format option to create a link is choosen.

If the label is optional, and there is no default link label, the phobne number will be used as anchor text. When the number is used as anchor text, the formatted version is shown, while the normalized version of the number is used for phone links.

If you add a phone number field to the user entity, you may want to prevent it from being dislayed as part of the user's public user profile, by setting its display property to “Hidden”.

Limitations

The phone field created by this module is a free format text field. There is no provision for custom formatters or country codes. The module is intentionally lightweight on features. There is no validation of the number entered.

While this may be perceived as a limitation by some, this also means that you can enter a number that is human viewable confirming to any local convention for displaying phone numbers, including hyphens and brackets.

Troubleshooting

FAQ

No questions yet.