public function NewShipmentForm::submitForm in Ubercart 8.4
Form submission handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormInterface::submitForm
File
- shipping/
uc_fulfillment/ src/ Form/ NewShipmentForm.php, line 136
Class
- NewShipmentForm
- Sets up a new shipment with the chosen packages.
Namespace
Drupal\uc_fulfillment\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$packages = [];
$i = 1;
foreach ($form_state
->getValue('shipping_types') as $shipping_type) {
if (is_array($shipping_type['table'])) {
foreach ($shipping_type['table'] as $id => $input) {
if ($input['checked']) {
$packages[$i++] = $id;
}
}
}
}
$form_state
->setRedirect('uc_fulfillment.make_shipment', [
'uc_order' => $form_state
->getValue('order_id'),
], [
'query' => array_merge([
'method_id' => $form_state
->getValue('method'),
], $packages),
]);
//$form_state['redirect'] = 'admin/store/orders/{uc_order}/ship/' . $form_state->getValue('method') . '/' . implode('/', $packages);
}