diff --git a/modules/order/src/Plugin/Commerce/InlineForm/CustomerProfile.php b/modules/order/src/Plugin/Commerce/InlineForm/CustomerProfile.php index 2457ccda..2fdf3823 100644 --- a/modules/order/src/Plugin/Commerce/InlineForm/CustomerProfile.php +++ b/modules/order/src/Plugin/Commerce/InlineForm/CustomerProfile.php @@ -17,13 +17,6 @@ use Drupal\profile\Entity\ProfileInterface; */ class CustomerProfile extends EntityInlineFormBase { - /** - * The form display used to build the profile form. - * - * @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface - */ - protected $formDisplay; - /** * {@inheritdoc} */ @@ -60,8 +53,8 @@ class CustomerProfile extends EntityInlineFormBase { $inline_form = parent::buildInlineForm($inline_form, $form_state); assert($this->entity instanceof ProfileInterface); - $this->formDisplay = EntityFormDisplay::collectRenderDisplay($this->entity, 'default'); - $this->formDisplay->buildForm($this->entity, $inline_form, $form_state); + $form_display = EntityFormDisplay::collectRenderDisplay($this->entity, 'default'); + $form_display->buildForm($this->entity, $inline_form, $form_state); if (!empty($inline_form['address']['widget'][0])) { $widget_element = &$inline_form['address']['widget'][0]; // Remove the details wrapper from the address widget. @@ -88,8 +81,9 @@ class CustomerProfile extends EntityInlineFormBase { parent::validateInlineForm($inline_form, $form_state); assert($this->entity instanceof ProfileInterface); - $this->formDisplay->extractFormValues($this->entity, $inline_form, $form_state); - $this->formDisplay->validateFormValues($this->entity, $inline_form, $form_state); + $form_display = EntityFormDisplay::collectRenderDisplay($this->entity, 'default'); + $form_display->extractFormValues($this->entity, $inline_form, $form_state); + $form_display->validateFormValues($this->entity, $inline_form, $form_state); } /** @@ -99,7 +93,8 @@ class CustomerProfile extends EntityInlineFormBase { parent::submitInlineForm($inline_form, $form_state); assert($this->entity instanceof ProfileInterface); - $this->formDisplay->extractFormValues($this->entity, $inline_form, $form_state); + $form_display = EntityFormDisplay::collectRenderDisplay($this->entity, 'default'); + $form_display->extractFormValues($this->entity, $inline_form, $form_state); $this->entity->save(); }