Feeds creates a translation for every mapped language even if there is no content for a feed item in that language. It seems that preventing this has been attempted but the code isn't working correctly. I fixed this by fixing the empty check of the value; I'm not sure if this is what the code was supposed to do from the start.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ZeiP created an issue. See original summary.

ZeiP’s picture

FileSize
547 bytes

Attached is a patch to fix this.

tommik’s picture

FileSize
726 bytes

Current patch prevents creation of empty translation, but it does not allow fields to be updated from having value to empty fields.

Altered patch so that is still prevents creation of empty translation but allow fields to be updated with empty values if the field exists.

kekkis’s picture

Assigned: Unassigned » kekkis
Status: Needs review » Needs work
FileSize
922 bytes
896 bytes

After applying patch from #3 there is a line in mappers.inc that breaks PHP <5.5 compatibility.

if (empty($value) || (is_array($value) && empty(reset($value)))) {

That line (70) gives me a fatal on PHP 5.4. The error message says:

Error: Can't use function return value in write context in /var/www/html/sites/all/modules/feeds_et/feeds_et.mappers.inc, line 70

And the reason, of course, is that since empty is a language construct instead of a function, it cannot be called with other values than variables in versions prior to PHP 5.5. Per Drupal 7 system requirements, the minimum supported version should be 5.2.5 and this module's info file does not state a minimum PHP version so we should change the implementation to support 5.2.5. Attached you'll find a patch to work the same way, less concise, and compatible with PHP <5.5. See interdiff too.

kekkis’s picture

Assigned: kekkis » Unassigned
Status: Needs work » Needs review

And of course one would forget to change back the status.