public function ProductAttributeDependencies::submitForm in Dropdown Attributes 8
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 ConfigFormBase::submitForm
File
- src/
Form/ ProductAttributeDependencies.php, line 148
Class
- ProductAttributeDependencies
- Administrative form for specifying the product attribute dependencies.
Namespace
Drupal\uc_dropdown_attributes\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$values = $form_state
->getValues();
foreach ($values['attributes'] as $aid => $attribute) {
\Drupal::database()
->merge('uc_dropdown_products')
->key(array(
'nid' => $values['product'],
'aid' => $aid,
))
->fields(array(
'parent_aid' => $attribute['parent'],
'parent_values' => serialize($attribute['values']),
'required' => $attribute['required'],
))
->execute();
}
parent::submitForm($form, $form_state);
}