function commerce_registration_tokens in Commerce Registration 7.2
Same name and namespace in other branches
- 7.3 commerce_registration.tokens.inc \commerce_registration_tokens()
- 7 commerce_registration.tokens.inc \commerce_registration_tokens()
Implements hook_tokens().
File
- ./
commerce_registration.tokens.inc, line 38 - Token support for Commerce Registration.
Code
function commerce_registration_tokens($type, $tokens, array $data = array(), array $options = array()) {
$replacements = array();
if ($type == 'registration' && !empty($data['registration'])) {
$reg = $data['registration'];
foreach ($tokens as $name => $original) {
switch ($name) {
case "commerce_order":
$replacements[$original] = $reg->order_id;
break;
}
}
}
if ($type == 'commerce-registration' && !empty($data['commerce-registration'])) {
$commerce_registration = $data['commerce-registration'];
foreach ($tokens as $name => $original) {
switch ($name) {
case 'registration-index':
$replacements[$original] = $commerce_registration['index'];
break;
}
}
}
return $replacements;
}