function _notify_content in Notify 7
Same name and namespace in other branches
- 8 notify.module \_notify_content()
- 5.2 notify.module \_notify_content()
- 5 notify.module \_notify_content()
- 6 notify.module \_notify_content()
- 1.0.x notify.module \_notify_content()
Formatting of body content.
Parameters
object $node: The node object to format.
object $comment: The comment object to format.
int $view_mode: view mode 0: Title only 1: Title + Teaser/Excerpt 2: Title + Body 3: Title + Body + Fields
1 call to _notify_content()
- _notify_send in ./
notify.module - Helper function to send the notification e-mail batch.
File
- ./
notify.module, line 443 - Notify module sends e-mail digests of new content and comments.
Code
function _notify_content($node, $comment, $view_mode) {
$txt = '';
if (0 == $view_mode) {
return $txt;
}
elseif (3 == $view_mode && !$comment) {
$content = node_view($node, 'full');
// Run of all children so that every attached field is also included.
$children = element_children($content, TRUE);
foreach ($children as $child) {
if (isset($content[$child]['#title']) && isset($content[$child][0]['#markup']) && $content[$child]['#access']) {
//We don't want field name included in the e-mail.
//$txt .= $content[$child]['#title'] . ': ';
$txt .= $content[$child][0]['#markup'];
}
}
return drupal_html_to_text($txt);
}
if (1 == $view_mode) {
$vmode = 'teaser';
}
else {
$vmode = 'full';
}
if ($comment) {
//@TODO Get trim_length from type.
if ('teaser' == $vmode) {
$comment->comment_body[LANGUAGE_NONE][0]['value'] = text_summary($comment->comment_body[LANGUAGE_NONE][0]['value'], NULL, 200);
}
$content = comment_view($comment, $node, $vmode);
if (isset($content['comment_body'][0]['#markup'])) {
$txt = $content['comment_body'][0]['#markup'];
}
}
else {
$content = node_view($node, $vmode);
if (isset($content['body'][0]['#markup'])) {
$txt = $content['body'][0]['#markup'];
}
}
return drupal_html_to_text($txt);
}