function signup_token_values in Signup 7
Same name and namespace in other branches
- 6.2 signup.module \signup_token_values()
- 6 signup.module \signup_token_values()
Implements hook_token_values() (from token.module)().
File
- ./
signup.module, line 1866 - The Signup module (http://drupal.org/project/signup) manages replies to nodes. In particular, it's good for event management. Signup supports sending reminder emails and automatically closing signups for nodes with a start time, via the Event…
Code
function signup_token_values($type = 'all', $object = NULL) {
$values = array();
if ($type == 'node') {
if (empty($object->signup)) {
$values['node-signup-enabled'] = t('disabled');
$values['node-signup-status'] = '';
$values['node-signup-limit'] = '';
}
else {
$values['node-signup-enabled'] = t('enabled');
$values['node-signup-status'] = $object->signup_status ? t('open') : t('closed');
$values['node-signup-limit'] = (int) $object->signup_close_signup_limit;
}
}
elseif ($type == 'signup') {
$signup_data = array();
if (!empty($object->form_data)) {
if (is_array($object->form_data)) {
$signup_data = $object->form_data;
}
else {
$signup_data = unserialize($object->form_data);
}
}
$values['signup-sid'] = $object->sid;
$values['signup-user-data'] = theme('signup_custom_data', array(
'data' => $signup_data,
));
$values['signup-user-data-raw'] = theme('signup_email_token_custom_data', array(
'signup_data' => $signup_data,
));
$values['signup-date-short'] = format_date($object->signup_time, 'short');
$values['signup-date-medium'] = format_date($object->signup_time, 'medium');
$values['signup-date-long'] = format_date($object->signup_time, 'long');
$values['signup-cancel-url'] = _signup_get_cancel_link($object->sid);
if (!empty($object->anon_mail)) {
$values['signup-email'] = $object->anon_mail;
}
elseif (!empty($object->mail)) {
$values['signup-email'] = $object->mail;
}
else {
$values['signup-email'] = '';
}
$values['signup-anonymous-email'] = !empty($object->anon_mail) ? $object->anon_mail : '';
$attended = isset($signup->attended) ? $signup->attended : NULL;
$values['signup-attendence'] = check_plain(theme('signup_attended_text', array(
'attended' => $attended,
)));
$values['signup-id'] = $object->sid;
}
return $values;
}