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
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

fago - July 17, 2007 - 13:17
Project:Automatic Nodetitles» Phone (CCK)
Version:5.x-1.0» 5.x-1.x-dev
Component:User interface» Code

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

neuromusic - September 20, 2008 - 23:12
Version:5.x-1.x-dev» 5.x-2.9
Category:bug report» feature request

I would be interested in seeing this happen

#3

Aren Cambre - September 22, 2008 - 01:54
Version:5.x-2.9» 5.x-1.x-dev
Category:feature request» bug report

Not sure why neuromusic changed this issue? Changing it back.

#4

akahn - March 18, 2009 - 14:05
Title:Phone - CCK content type not available in Replacement Patterns dropdown» Add token support for Phone module
Category:bug report» feature request
Status:active» needs review

I added the following to phone.module. It's based on the token support in email.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

NikLP - August 17, 2009 - 16:11

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.

 
 

Drupal is a registered trademark of Dries Buytaert.