function webform_token_info in Webform 7.4
Same name and namespace in other branches
- 8.5 webform.tokens.inc \webform_token_info()
- 6.x webform.tokens.inc \webform_token_info()
Implements hook_token_info().
File
- ./
webform.tokens.inc, line 11 - Builds placeholder replacement tokens for webform-related data.
Code
function webform_token_info() {
// Webform submission tokens.
$info['types']['submission'] = array(
'name' => t('Submission'),
'description' => t('Tokens related to webform submissions.'),
'needs-data' => 'webform-submission',
);
$info['tokens']['submission']['serial'] = array(
'name' => t('Serial number'),
'description' => t('The serial number of this webform submission.'),
);
$info['tokens']['submission']['sid'] = array(
'name' => t('Submission ID'),
'description' => t('The unique indentifier for the webform submission.'),
);
$info['tokens']['submission']['access-token'] = array(
'name' => t('Access token'),
'description' => t('The security token used to gain access to this webform submission.'),
);
$info['tokens']['submission']['date'] = array(
'name' => t('Date created'),
'description' => t('The date the webform submission was first saved, either as a draft or completed.'),
'type' => 'date',
);
$info['tokens']['submission']['completed_date'] = array(
'name' => t('Date completed'),
'description' => t('The date the webform submission was completed (no longer a draft).'),
'type' => 'date',
);
$info['tokens']['submission']['modified_date'] = array(
'name' => t('Date modified'),
'description' => t('The date the webform submission was last saved, either as a draft or completed.'),
'type' => 'date',
);
$info['tokens']['submission']['ip-address'] = array(
'name' => t('IP address'),
'description' => t('The IP address that was used when submitting the webform.'),
);
$info['tokens']['submission']['user'] = array(
'name' => t('Submitter'),
'description' => t('The user that submitted the webform result.'),
'type' => 'user',
);
$info['tokens']['submission']['url'] = array(
'name' => t('URL'),
'description' => t("Webform tokens related to the submission's URL."),
'type' => 'url',
);
$info['tokens']['submission']['edit-url'] = array(
'name' => t('Edit URL'),
'description' => t("Webform tokens related to the submission's Edit URL."),
'type' => 'url',
);
$info['tokens']['submission']['values'] = array(
'name' => t('Webform submission values'),
'description' => '<div>' . t('Webform tokens from submitted data. Replace the "?" with the "form key", including any parent form keys separated by colons. You can append:') . '</div><ul>' . '<li>' . t('the question key for just that one question (grid components).') . '</li>' . '<li>' . t('the option key for just that one option (grid and select components).') . '</li>' . '<li>' . t('<code>@token</code> for the value without the label (the default).', array(
'@token' => ':nolabel',
)) . '</li>' . '<li>' . t('<code>@token</code> for just the label.', array(
'@token' => ':label',
)) . '</li>' . '<li>' . t('<code>@token</code> for both the label and value together.', array(
'@token' => ':withlabel',
)) . '</li>' . '<li>' . t('<code>@token</code> for just the key in a key|label pair (grid and select components).', array(
'@token' => ':key',
)) . '</li></ul>',
'dynamic' => TRUE,
);
return $info;
}