Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I have a content type with a filefield, and i´ve enabled module diff to show diferences between revisions.
The problem is that when i change de filelield a new revision is created but when i push the button to show diffs it's says that there is no difference between the two revision.
whats happening
thanks
Comment | File | Size | Author |
---|---|---|---|
#3 | filefield_diff.patch | 814 bytes | quicksketch |
Comments
Comment #1
quicksketchI haven't tried using diff with FileField, but it doesn't surprise me it doesn't work out-of-box. CCK currently is providing all the diff functionality for FileField, using the default comparison function. This comparison checks for a "value" property, but FileField doesn't actually have a value property, it uses a file "fid" as the primary value.
It looks like FileField can implement hook_content_diff_values() to solve this problem, I'm moving this to a feature request.
Comment #2
quicksketchComment #3
quicksketchThis patch adds basic Diff support, comparing the upload file paths. It doesn't take into consideration Alt, Title, or Description texts, I'm not sure if they'd be appropriate to include (Diff's upload.module support doesn't support descriptions either).
Comment #4
infodrupal CreditAttribution: infodrupal commentedI've tried the patch and i think it works.
I've made some changes because i'm interested only in the filename. The code is as follows:
function filefield_content_diff_values($node, $field, $items) {
$return = array();
foreach ($items as $item) {
if (is_array($item) && !empty($item['filepath'])) {
$file = basename($item['filepath']);
$filename = explode(".",$file);
$return[] = $filename[0];
}
}
return $return;
}
I think this is a beginning because it would be fantastic if the module could show other differences like description, name or timestamp.
Comment #5
Encarte CreditAttribution: Encarte commentedsubscribing
Comment #6
Agileware CreditAttribution: Agileware commentedPatch #3 works for me and would be a great addition to FileField.
Comment #7
quicksketchWell basic support is better than no support. Committed #3.