The Diff modules comes with an 'inline differences' block that highlights the differences between the current node and a selected previous revision. The module classifies differences as 'Added', 'Changed' or 'Deleted' and highlights appropriately using a CSS class.

On my site ( which uses Empty Fields ) the Diff module incorrectly identifies added field content as changed ( and also correctly identifies changed field content as changed ). When I turn off the Empty Fields module and refresh the page the Diff module works fine again and added field content is marked as such.

A bit obscure but any ideas ?

Thanks

Comments

El Bandito’s picture

Category: bug » support

I've done a bit more investigation of this issue. Perhaps the word 'conflict' was a bit strong - the modules really just don't work together.

The Diff module builds 2 html strings representing the 'full' view mode of 2 versions ( version id ) of a node and then compares them. In pseudocode somthing like :

$old_node = node_load($nid, $old_vid);
node_build_content($old_node);  // defaults to 'full' view mode
$old_node_rendered = drupal_render($old_node->content);

$new_node = node_load($nid, $new_vid);
node_build_content($new_node);
$new_node_rendered = drupal_render($new_node->content);

$diff = compare($old_node_rendered, $new_node_rendered);

The empty fields module hooks into the field preparation process via hook_field_attach_view_alter() and injects the empty text where the field is approrpiately configured. The empty text therefore messes with diff's comparison.

Is there a way to avoid this ? Happy to hack either module given a good suggestion.

Changing from bug >> support request.

Thanks

Alan D.’s picture

This is per design as per the Diff module.

Diffs are done per view mode, so you would need to configure the Revision comparison view mode not to use empty text.

Hope this helps.

El Bandito’s picture

Status: Active » Closed (works as designed)

Thanks Alan. I wasn't aware of the 'Revision comparison' view mode, but it should sort me out perfectly.

Closing this issue.