function subscriptions_cck_subscriptions_get_mailvars in Subscriptions 5.2
Same name and namespace in other branches
- 6 subscriptions_cck.module \subscriptions_cck_subscriptions_get_mailvars()
Implementation of hook_subscriptions_add_mailvars(). Add the !cck... variables.
File
- ./
subscriptions_cck.module, line 40 - 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');
}
$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;
}