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.
Description
I have 2 profile types that have a 'list (text)' field. When i click on 'My x is the same as y', all the text fields are correctly removed / filled in. But the list field is still visible and not copied.
Fix
In the copy fields, there is a check if the items of a field is an array. For the list type, this is not the case. Add an else state, that handles non array items.
The same is done in the profile pane form.
Comment | File | Size | Author |
---|---|---|---|
#1 | profile_copy-support-list-1909476-1.patch | 2.5 KB | nils.destoop |
Comments
Comment #1
nils.destoop CreditAttribution: nils.destoop commentedIncluded a patch that fixes this problem.
It will also fix a notice, when the profile type doesn't have an address field.
Comment #2
nils.destoop CreditAttribution: nils.destoop commentedComment #3
rszrama CreditAttribution: rszrama commentedExcellent find. I had to expand the scope just a little bit to also accommodate multi-value field widgets that use a single form element to collect multiple values, like a multi-value List (text) field. Also, I discovered that the reason your patch works is because Drupal's core Field API is schizophrenic. There's no reason a single value List (text) field should have a scalar items array, even for a single value field. The pattern with pretty much everything else is to use a single value array - but here Drupal follows PHP and invents an exception to the rule just to keep us guessing. : )
Welcome to the committers log!
Commit: http://drupalcode.org/project/commerce.git/commitdiff/769ff5b