Add token support for Phone module
Aren Cambre - July 9, 2007 - 02:43
| Project: | Phone (CCK) |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Jump to:
Description
Under the Pattern for the title field is a dropdown named Replacement patterns. CCK fields created with the Phone - CCK module do not show in this list under CCK text tokens.

#1
then the either the phone module needs support for the token module, or the token module needs to include support for phone cck fields.
#2
I would be interested in seeing this happen
#3
Not sure why neuromusic changed this issue? Changing it back.
#4
I added the following to
phone.module. It's based on the token support inemail.module. Like that module, it only uses the first phone number, if it is a field that allows multiple entries. Please test this and let me know what you think.<?php
/**
* Implementation of hook_token_list
*/
function phone_token_list($type = 'all') {
if ($type == 'field' || $type == 'all') {
$tokens['phone']['phone'] = t("Phone number");
return $tokens;
}
}
/**
* Implementation of hook_token_values
*/
function phone_token_values($type, $object = NULL, $options = array()) {
if ($type == 'field') {
$item = $object[0];
$tokens['phone'] = check_plain($item['view']);
return $tokens;
}
}
?>
#5
Basically, you need to post a patch and it needs to be for D6 for there to be any realistic chance of this getting tested, reviewed or committed.