You are here

public function LineItems::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/LineItems.php, line 161

Class

LineItems
View and modify an order's line items.

Namespace

Drupal\uc_order\Plugin\Ubercart\OrderPane

Code

public function submitForm(OrderInterface $order, array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();
  if (is_array($values['line_items'])) {
    foreach ($values['line_items'] as $line) {
      if (is_numeric($line['li_id']) && intval($line['li_id']) > 0 && isset($line['title']) && isset($line['amount'])) {
        uc_order_update_line_item($line['li_id'], $line['title'], $line['amount']);
      }
    }
  }
}