I've tried Unique Field 7.x-1.0-beta1, in a Drupal 7 installation, with default language set to Spanish.
On editing nodes, the following messages are registered on watchdog, and Unique Field won't detected repeated values:
Warning: Invalid argument supplied for foreach() en unique_field_node_validate() (línea 168 de /var/www/drupal/sites/default/modules/unique_field/unique_field.module).
Warning: array_values() expects parameter 1 to be array, null given en _field_filter_items() (línea 494 de /var/www/drupal/modules/field/field.module).
The problem seems to be in these lines:
166 $f = $node->$field;
167 $values = $f[LANGUAGE_NONE];
168 foreach ($values as $index => $value) {
[..]
}
In my installation, the $f variable is indexed with the 'es' language code:
array(1) {
["es"]=> array(1) { [0]=> array(1) { ["email"]=> string(22) "yyyyyy@gmail.com" } }
}
So, the $f[LANGUAGE_NONE] (aka $f['und']) element is undefined, the field content is in $f['es'] instead.
Thank you in advance, for your help.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | unique_field-1037904-2.patch | 621 bytes | boobaa |
Comments
Comment #1
mcotelo commentedComment #2
boobaaMet the same warnings. Attached patch seems to solve the issue.
Comment #3
arithmetric commentedThanks for this report and patch. I've fixed this bug in the latest release (7.x-1.0-beta2).