You are here

function upload_diff in Diff 5

Same name and namespace in other branches
  1. 5.2 upload.inc \upload_diff()
  2. 6.2 includes/upload.inc \upload_diff()
  3. 6 upload.inc \upload_diff()

Implementation of hook_diff() for file attachments.

File

./upload.inc, line 6

Code

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 $file) {
      $new_files[] = $file->filename;
    }
  }
  $result[] = array(
    'name' => t('Attachments'),
    'old' => $old_files,
    'new' => $new_files,
    'format' => array(
      'show_header' => false,
    ),
  );
  return $result;
}