phoneus

Experimental project

This is a sandbox project, which contains experimental code for developer use only.

After searching around, I noticed there was no simple solution for a US based phone number formatter. There are a couple solutions (Phone and Phone Number) for US and International, using a separate formatter and field, but nothing I could see that I could use with a simple textfield.

This module adds an extra formatter to textfields that allows you to select "US Phone Number". The module converts the phone number into the standard US phone number format.

To set up:
1. Turn the module on like usual (Drush en phoneus)
2. Create a textfield, and limit output to 10.
2. Under manage display, select "US Phone Number".

Output: (123) 124-1234

TODO: add JS formatting for user while typing. Remove limit, as JS will validate this. Add the 0 for views bug.

Project information