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.
The store address field can disappear and a very special occasion.
Here is how to reproduce on FF Linux at least.
- Create a new store,
- Change the country address,
- Change again the country address to pick the "select" value
- KABOOM the address field disappears.
Comment | File | Size | Author |
---|---|---|---|
#5 | address-required-2633972-5.patch | 1.03 KB | czigor |
Comments
Comment #2
czigor CreditAttribution: czigor at Liip for FREITAG lab. AG commentedI'm not sure I can reproduce this. Here's what I've done:
1. I created a store with country 'Switzerland'. Saved the store.
2. Edited the store and changed the country to 'Afghanistan'. Saved the store.
3. Edited the store again and changed the country to 'Select'. The other address fields disappeared but I think that's the intended behaviour. When I select a country, they come back.
Comment #3
ArtusamakI think that when you click on "Select" the address section shouldn't be refreshed.
Comment #4
bojanz CreditAttribution: bojanz at Centarro commentedAh, I now understand.
This is the correct behavior, Select is supposed to hide the fields and store nothing.
However, the store address is a required field, so there shouldn't actually be a "Select" option.
That's our bug.
Comment #5
czigor CreditAttribution: czigor at Liip for FREITAG lab. AG commentedThis is an Address bug, also present in Profile addresses for example.
The issue is that the $address_element['country_code']['#empty_value'] is set and this triggers adding the '- Select -' option in \Drupal\Core\Render\Element\Select::processSelect(). #empty_value should only be set if the address is not required.
Patch solves this.
Comment #6
czigor CreditAttribution: czigor at Liip for FREITAG lab. AG commentedComment #7
czigor CreditAttribution: czigor at Liip for FREITAG lab. AG commentedComment #8
bojanz CreditAttribution: bojanz at Centarro commentedCommitted, thanks!