You are here

public function AttributeOptionsForm::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_attribute/src/Form/AttributeOptionsForm.php, line 99

Class

AttributeOptionsForm
Displays options and the modifications to products they represent.

Namespace

Drupal\uc_attribute\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  foreach ($form_state
    ->getValue('options') as $oid => $option) {
    \Drupal::database()
      ->update('uc_attribute_options')
      ->fields([
      'ordering' => $option['ordering'],
    ])
      ->condition('oid', $oid)
      ->execute();
  }
  $this
    ->messenger()
    ->addMessage($this
    ->t('The changes have been saved.'));
}