test meta tokens

This commit is contained in:
Nathan Coad
2018-06-16 21:53:17 +10:00
parent 6f971767f0
commit 5fe2d8d88d
3 changed files with 67 additions and 22 deletions

View File

@@ -370,10 +370,10 @@ function booking_tokens_admin_validate($form, $form_state) {
function booking_token_info() {
$info['types']['booking'] = array(
'name' => t('Booking Tokens'),
'description' => t('Tokens related to bookings module.'),
'needs-data' => 'booking',
);
'name' => t('Booking Tokens'),
'description' => t('Tokens related to bookings module.'),
'needs-data' => 'booking',
);
$info['tokens']['booking']['eventname'] = array(
'name' => t('Event Name'),
'description' => t('Name of the current event.')
@@ -510,6 +510,28 @@ function booking_token_info() {
'name' => t('Travel form Link'),
'description' => t('Link to the person\'s travel form.')
);
$info['types']['meta-booking'] = array(
'name' => t('Meta Booking Tokens'),
'description' => t('Sub-tokens for the booking module that are used by other booking module tokens. They will only work in a very limited context.'),
'needs-data' => 'booking',
);
$info['tokens']['meta-booking']['studygroup-descrip'] = array(
'name' => t('Study Group Description'),
'description' => t('Used in the studygroup-summary token.')
);
$info['tokens']['meta-booking']['studygroup-weekday'] = array(
'name' => t('Study Group Weekday'),
'description' => t('Used in the studygroup-summary token.')
);
$info['tokens']['meta-booking']['studygroup-explan'] = array(
'name' => t('Study Group Explanation'),
'description' => t('Used in the studygroup-summary token.')
);
$info['tokens']['meta-booking']['studygroup-role'] = array(
'name' => t('Study Group Role'),
'description' => t('Used in the studygroup-summary token.')
);
return $info;
}
@@ -542,7 +564,7 @@ function booking_tokens($type, $tokens, array $data = array(), array $options =
$replacements = array();
$sanitize = !empty($options['sanitize']);
if ($type == 'booking') {
if ($type == 'booking' || $type == 'meta-booking') {
foreach ($tokens as $name => $original) {
if (array_key_exists($name, $data)) {
$replacements[$original] = $data[$name];
@@ -646,7 +668,6 @@ function booking_define_personspecific_tokens($node)
$tokens['confirm-payment-link'] = url('confirm/' . $tempid, array('absolute' => TRUE));
}
//if payment processor is set to manual then don't populate these tokens
//if paypal is enabled
if ($payment_processor_type == 0) {