If a list field is predefined with one or more key|value pair of allowed values the node_diff in the node.inc file return the key stored intead of the value.

I fix this with the following changes:

<?php

        // the next 2 lines were inserted at line 33
       $field_info = field_info_field($field_name);
        $allowed_values = isset($field_info['settings']['allowed_values']) ? $field_info['settings']['allowed_values'] : '' ;

            // the next 2 lines replaced the lines 40 and 41
            '#old' => explode("\n", (count($allowed_values) && isset($allowed_values[$view_old]) ? $allowed_values[$view_old] : $view_old)),
            '#new' => explode("\n", (count($allowed_values) && isset($allowed_values[$view_new]) ? $allowed_values[$view_new] : $view_new)),

            // the line 51 were replaced with this one
            '#new' => explode("\n", (count($allowed_values) && isset($allowed_values[$view_new]) ? $allowed_values[$view_new] : $view_new)),

            // the line 59 were replaced with this one
            '#old' => explode("\n", (count($allowed_values) && isset($allowed_values[$view_old]) ? $allowed_values[$view_old] : $view_old)),<em>

            // the line 72 were replaced with this one
            '#old' => explode("\n", (count($allowed_values) && isset($allowed_values[$view_old]) ? $allowed_values[$view_old] : $view_old)),

?>

Can you include this patch for your next version?
Thanks, Daneel.

Comments

rocketeerbkw’s picture

Diff 7.x-3.0-alpha1 includes this functionality already by letting you choose what should be compared (label, key, label (key)) at admin/config/content/diff/fields/list_text

daneelcm’s picture

Status: Active » Fixed

OK thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.