| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: upload.inc,v 1.1.2.2 2010/08/12 16:34:08 yhahn Exp $ 3 4 /** 5 * @file 6 * Implementation of hook_diff() for file attachments. 7 */ 8 9 /** 10 * Implementation of hook_diff() for file attachments. 11 */ 12 function upload_diff($old_node, $new_node) { 13 $result = array(); 14 $old_files = array(); 15 if (isset($old_node->files)) { 16 foreach ($old_node->files as $file) { 17 $old_files[] = $file->filename; 18 } 19 } 20 $new_files = array(); 21 if (isset($new_node->files)) { 22 foreach ($new_node->files as $key => $file) { 23 if (is_array($file)) { 24 // During editing the files are stored as arrays, not objects. 25 if ($file['remove']) { 26 // It looks better if a blank line is inserted for removed files. 27 $new_files[] = ''; 28 } 29 else { 30 $new_files[] = $file['filename']; 31 } 32 } 33 else { 34 $new_files[] = $file->filename; 35 } 36 } 37 } 38 $result['attachments'] = array( 39 '#name' => t('Attachments'), 40 '#old' => $old_files, 41 '#new' => $new_files, 42 '#weight' => 30, 43 '#format' => array( 44 'show_header' => FALSE, 45 ) 46 ); 47 return $result; 48 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |