Commit 050f8970 authored by Blanca.Esqueda's avatar Blanca.Esqueda Committed by bojanz

Issue #2760387 by dww, Blanca.Esqueda: Default country is imposed on fields...

Issue #2760387 by dww, Blanca.Esqueda: Default country is imposed on fields with an empty address (which currently prevents changing the default country at all)
parent fd899d80
......@@ -186,7 +186,7 @@ class AddressDefaultWidget extends WidgetBase implements ContainerFactoryPluginI
*/
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$item = $items[$delta];
$value = $item->isEmpty() ? $this->getInitialValues() : $item->toArray();
$value = $item->getEntity()->isNew() ? $this->getInitialValues() : $item->toArray();
// Calling initializeLangcode() every time, and not just when the field
// is empty, ensures that the langcode can be changed on subsequent
// edits (because the entity or interface language changed, for example).
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment