/[drupal]/contributions/modules/send/theme/send.theme.inc
ViewVC logotype

Diff of /contributions/modules/send/theme/send.theme.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.6, Mon Aug 17 21:38:15 2009 UTC revision 1.7, Wed Aug 26 01:18:14 2009 UTC
# Line 1  Line 1 
1  <?php // $Id: send.theme.inc,v 1.5 2009/08/07 01:00:05 vauxia Exp $  <?php // $Id: send.theme.inc,v 1.6 2009/08/17 21:38:15 vauxia Exp $
2    
3  function send_theme_theme() {  function send_theme_theme() {
4    $path = drupal_get_path('module', 'send') .'/theme';    $path = drupal_get_path('module', 'send') .'/theme';
# Line 71  function theme_send_body($body, $profile Line 71  function theme_send_body($body, $profile
71    if ($template) {    if ($template) {
72      $body = $template->body;      $body = $template->body;
73    }    }
74      $build_mode = isset($values['build_mode']) ? $values['build_mode'] : 'teaser';
75    
76      $tokens = $replace = array();
77    
78      // The content may have been supplied. If not, generate!
79      if ($values['content']) {
80        $content = '';
81        foreach ($values['content'] as $name => $data) {
82          if (isset($data['nid'])) {
83            $delta = $i+1;
84            $node = node_load($data['nid']);
85            if (!isset($data['content'])) {
86              $node->build_mode = isset($data['build_mode']) ? $data['build_mode'] : $build_mode;
87              $teaser = $node->build_mode == 'teaser';
88              $data['content'] = node_view($node, $teaser);
89            }
90    
91            if (module_exists('token')) {
92              $tok = token_get_values('node', $node);
93              foreach ($tok->tokens as $k => $v) {
94                $tok->tokens[$k] = '['. $v .']';
95              }
96    
97              // Use unqualified tokens for the first node.
98              if ($delta == 1) {
99                $tokens = array_merge($tokens, $tok->tokens);
100                $replace = array_merge($replace, $tok->values);
101              }
102    
103              // Create a set of tokens for each included node.
104              foreach ($tok->tokens as $k => $v) {
105                $tok->tokens[$k] = '[node'. $delta .'-'. substr($v, 1);
106              }
107              $tokens = array_merge($tokens, $tok->tokens);
108              $replace = array_merge($replace, $tok->values);
109            }
110          }
111          if (isset($data['content'])) {
112            $content .= $values[$name] = $data['content'];
113          }
114        }
115        $values['body'] = $content;
116      }
117    
118    foreach ($values as $key => $value) {    foreach ($values as $key => $value) {
119      if ($key && is_scalar($value)) {      if ($key && is_scalar($value)) {
# Line 86  function theme_send_body($body, $profile Line 129  function theme_send_body($body, $profile
129      $replace = array_merge($replace, $tok->values);      $replace = array_merge($replace, $tok->values);
130    }    }
131    
   // The content may have been supplied. If not, generate!  
   if ($values['nids']) {  
     foreach ($values['nids'] as $i => $nid) {  
       $delta = $i+1;  
       $node = node_load($nid);  
       if (module_exists('token')) {  
         $tok = token_get_values('node', $node);  
         foreach ($tok->tokens as $k => $v) {  
           $tok->tokens[$k] = '['. $v .']';  
         }  
   
         // Use unqualified tokens for the first node.  
         if ($delta == 1) {  
           $tokens = array_merge($tokens, $tok->tokens);  
           $replace = array_merge($replace, $tok->values);  
         }  
   
         // Create a set of tokens for each included node.  
         foreach ($tok->tokens as $k => $v) {  
           $tok->tokens[$k] = '[node'. $delta .'-'. substr($v, 1);  
         }  
         $tokens = array_merge($tokens, $tok->tokens);  
         $replace = array_merge($replace, $tok->values);  
       }  
     }  
   }  
   
132    $body = str_replace($tokens, $replace, $body);    $body = str_replace($tokens, $replace, $body);
133    if (isset($template->format)) {    if (isset($template->format)) {
134      $body = check_markup($body, $template->format);      $body = check_markup($body, $template->format);

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.2