Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If a field is imported as null (i.e. with feeds xpath parser for an xml node that is missing an element) feeds tamper will skip tampering the field. It would be nice to allow these fields to be tampered anyway.
Patch to follow.
Comment | File | Size | Author |
---|---|---|---|
#1 | 1508584-1-feeds_tamper-allow_null_tamper.patch | 749 bytes | elliotttf |
Comments
Comment #1
elliotttf CreditAttribution: elliotttf commentedComment #2
chrisroditis CreditAttribution: chrisroditis commentedWorks wonderfully!
Comment #3
twistor CreditAttribution: twistor commentedI'm not sure this is desirable in all cases. I know from experience that something is needed though.
There's actually two different use cases here. Tampering NULL, which would be the following patch. This is going in either way:
Then there's setting the field to NULL if it was unset. This is also needed, but sometimes it is undesired.
Comment #4
elliotttf CreditAttribution: elliotttf commentedI believe the original patch achieves both cases. The reason isset and array_key_exists were both used was to short circuit the conditional with the more performant isset if the null case wasn't needed.
I agree that there may be cases where setting the field to null might be undesirable but I haven't personally hit one of those cases yet. If someone can chime in with a use case where that'd be a bad idea I'd be happy to bounce around some other ideas.
Comment #5
twistor CreditAttribution: twistor commentedThis was fixed a long time ago.