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.
Hi,
I have a feed that may contain for each item:
- property1
- (property2)
property1
is always present and has a value, while property2
sometimes just doesn't exist.
Is there a way during the mapping that property2
is put into my_custom_field
only if it exists, otherwise put property1
?
Thanks!
Comment | File | Size | Author |
---|---|---|---|
#5 | feeds_tamper-2528326-4.patch | 1.16 KB | Ludo.R |
#3 | feeds_tamper-2528326-3.patch | 1.19 KB | Ludo.R |
Comments
Comment #1
Ludo.RComment #2
twistor CreditAttribution: twistor as a volunteer commentedThis is theoretically possible. We'd need to add an option to the copy plugin to only copy if not empt(). Then you could copy property1, then conditionally copy property2.
Comment #3
Ludo.RSomething like this?
I'm not sure about the to/from thing, maybe the option checkbox is not enough to cover all use cases, and I'm also a bit confused with the terminology about source (which one is the source when selecting to/from?).
To summarize, maybe there should be an option like "don't copy if source is empty" and another one "don't copy if destination is empty"
Comment #5
Ludo.RSmall fix (syntax error)
Comment #6
twistor CreditAttribution: twistor as a volunteer commentedComment #7
Blanca.Esqueda CreditAttribution: Blanca.Esqueda as a volunteer and at Portage CyberTech commentedI had a similar situation where if a value was empty then another field value needed to be used.
I created a path for the rewrite plugin as it has the flexibility not only to use a replacement patterns but as well a custom strings, or a mix of both.
http://www.drupal.org/node/2632056