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.
Problem/Motivation
Several issues point out many expected behaviors when importing empty, NULL or 0 values into fields. Fixes are pushing each of those behaviors, but they are mostly conflicting:
- Do not touch: skip setting the target value. In case of updating items, this preserves the previous value.
- Import anyway: Overwrite the target value with blank, NULL or 0. For numeric values, this can be useful. However, in most cases, this will cause empty fields to have a label unexpectedly displayed.#1528784: Behavior when importing empty/blank values for numeric field
Default: Do not touch. (This is current behavior.)
Proposed resolution
For now, I propose we implement a switch behavior somewhere in the settings. When #860748: Config for mappers? gets in, we will have this as a mapper config. Each mapper, however, needs it's own implementation with proper logic.
Remaining tasks
Let's list issues for each mapper:
- Date: #857216: Behavior on importing empty/NULL/invalid dates
- Files: #1047894: Behavior when fields/columns are not in import file: do not clear field, but leave field untouched.
- Numeric fields: #1528784: Behavior when importing empty/blank values for numeric field
- Text: #1107522: Framework for expected behavior when importing empty/blank values + text field fix
- Taxonomy Term: #1668186: Taxonomy terms auto-created with empty name.
User interface changes
In case we implement a setting, it should alter the config interface for a source.
Comments
Comment #0.0
a.ross CreditAttribution: a.ross commentedUpdated issue summary.
Comment #1
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedAll was handled in #1107522: Framework for expected behavior when importing empty/blank values + text field fix. To ignore empty values instead of overwriting the target with it, you can try the experimental Feeds empty module.