Closed (fixed)
Project:
Money field
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
8 Oct 2007 at 09:27 UTC
Updated:
26 Oct 2007 at 12:31 UTC
It dosn't show up in auto_nodetitle(Automatic title generation") list. evenif I add it manually, still it wouldn't recognized.
Comments
Comment #1
hamidrj commentedjust add this at the end of money module:
/**
* Implementation of hook_token_values
*
* @param string $type $type contains the current context -- 'node', 'user', 'global', etc.
* @param mixed $object contains the specific node, user, etc. that should be used as the basis for the replacements.
* @return array $tokens
*/
function money_token_values($type, $object = NULL) {
if ($type == 'field') {
$tokens = array();
$something = $object[0];
$tokens['money'] = $something['view'];
$tokens['currency'] = $something['currency'];
$tokens['amount'] = $something['amount'];
return $tokens;
}
} // function money_token_values()
/**
* Implementation of hook_token_list
*
* @param string $type indicates the context that token help is being generated for.
* @return array $tokens
*/
function money_token_list($type = 'all') {
if ($type == 'field' || $type == 'all') {
$tokens = array();
$tokens['money']['money'] = t("money");
$tokens['money']['currency'] = t("currency");
$tokens['money']['amount'] = t("amount");
return $tokens;
}
} // function money_token_values()
Comment #2
wim leersPlease create a patch next time. I'll accept this code, since it's only new code.
As soon as I have some time to test your code, I'll commit it.
Comment #3
wim leersThanks, committed!
Comment #4
(not verified) commented