function subscriptions_cck_subscriptions_get_mailvars in Subscriptions 6
Same name and namespace in other branches
- 5.2 subscriptions_cck.module \subscriptions_cck_subscriptions_get_mailvars()
Implementation of hook_subscriptions_get_mailvars().
Add the !cck... variables.
File
- ./
subscriptions_cck.module, line 34 - Provide support of CCK fields by adding corresponding mailvars.
Code
function subscriptions_cck_subscriptions_get_mailvars($node) {
$mailvars = array();
if (isset($node->type) && ($fields = content_fields(NULL, $node->type))) {
foreach ($fields as $field_name => $field_info) {
if (isset($node->{$field_name})) {
$values = $node->{$field_name};
$formatteds = array();
foreach ($values as $value) {
if (!($formatted = html_entity_decode(content_format($field_info, $value, 'plain'), ENT_QUOTES, 'UTF-8'))) {
$formatted = content_format($field_info, $value, 'default');
}
$formatted = drupal_html_to_text($formatted);
$formatteds[] = $formatted;
}
$mailvars['!ccklabel_' . $field_name] = $field_info['widget']['label'];
$mailvars['!cckvalue1_' . $field_name] = implode(', ', $formatteds);
$mailvars['!cckvalue2_' . $field_name] = implode("\n", $formatteds);
}
}
}
return $mailvars;
}