Hello! What about working D7 port?
I just found that hooks that module is using are incorrect.
So, this code provide lnid token to token list, but other function's working I can't check.
Was:
/**
* Implement hook_token_list() .
*/
function type_local_nids_token_list($type = 'all') {
if($type == 'node' || $type == 'all') {
$tokens['node']['lnid'] = t("The type-local nid.");
return $tokens;
}
}
Should be:
/**
* Implement hook_token_info().
*/
function type_local_nids_token_info() {
$info['tokens']['node']['lnid'] = array(
'name' => t('The type-local nid.'),
'description' => t('The type-local nid description.'),
);
return $info;
}
Was:
/**
* Implement hook_token_values() .
*/
function type_local_nids_token_values($type, $object = NULL, $options = array()) {
if($type == 'node') {
$tokens['lnid'] = $object->lnid;
return $tokens;
}
}
Should be something like this:
/**
* Implement hook_tokens().
*/
function type_local_nids_tokens($type, $tokens, $data = array(), $options = array()) {
$replacements = array();
if ($type == 'node' && !empty($data['node'])) {
if (isset($tokens['lnid'])) {
$original = $tokens['lnid'];
$replacements[$original] = $data->lnid;
}
}
return $replacements;
}
I think it need some minutes to make module port working.
Or maybe [node:content-type:node-count] token will work like Type local nids module?#1037312: How [node:content-type:node-count] token works?
Comments
Comment #1
tommychrisA little change in the token part - adter this change, I'm able to use the [node:lnid] token to use in auto nodetitle
To use the token [node:lnid] in autotitle, go to this thread: #349524: lnid not available in presave hook
Comment #2
JohnnyX commentedHello,
I'm searching for a module to set unique numbers to content types (like unique ticket numbers). This module seems to be the solution but is the D7 version atomic? I have seen an open D6 issue and not sure if fixed at D7 dev module...
Best regards
Comment #3
tommychrisNo, it's not. Serial field module is atomic, but it doesn't have a proper D7 release. :/
Comment #4
tommychris