public function OrderStatusAddForm::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
- uc_order/
src/ Form/ OrderStatusAddForm.php, line 90
Class
- OrderStatusAddForm
- Presents the form to create a custom order status.
Namespace
Drupal\uc_order\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
OrderStatus::create([
'id' => strtolower(trim($form_state
->getValue('id'))),
'name' => $form_state
->getValue('name'),
'state' => $form_state
->getValue('state'),
'weight' => (int) $form_state
->getValue('weight'),
])
->save();
$this
->messenger()
->addMessage($this
->t('Custom order status created.'));
$form_state
->setRedirect('uc_order.workflow');
}