View source
<?php
function upload_diff(&$old_node, &$new_node) {
$result = array();
$old_files = array();
if (isset($old_node->files)) {
foreach ($old_node->files as $file) {
$old_files[] = $file->filename;
}
}
$new_files = array();
if (isset($new_node->files)) {
foreach ($new_node->files as $key => $file) {
if (is_array($file)) {
if ($file['remove']) {
$new_files[] = '';
}
else {
$new_files[] = $file['filename'];
}
}
else {
$new_files[] = $file->filename;
}
}
}
$result['attachments'] = array(
'#name' => t('Attachments'),
'#old' => $old_files,
'#new' => $new_files,
'#weight' => 30,
'#format' => array(
'show_header' => false,
),
);
return $result;
}