You are here

public function AddressPaneBase::submitForm in Ubercart 8.4

Form submission handler.

Parameters

\Drupal\uc_order\OrderInterface $order: The order that is being viewed.

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides EditableOrderPanePluginInterface::submitForm

File

uc_order/src/Plugin/Ubercart/OrderPane/AddressPaneBase.php, line 79

Class

AddressPaneBase
Provides a generic address pane that can be extended as required.

Namespace

Drupal\uc_order\Plugin\Ubercart\OrderPane

Code

public function submitForm(OrderInterface $order, array &$form, FormStateInterface $form_state) {
  $pane = $this->pluginDefinition['id'];
  $address = $order
    ->getAddress($pane);
  foreach ($form_state
    ->getValue($pane) as $key => $value) {
    if (uc_address_field_enabled($key)) {
      $address->{$key} = $value;
    }
  }
  $order
    ->setAddress($pane, $address);
}