public function ClassAttributeDependencies::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/ ClassAttributeDependencies.php, line 149
Class
- ClassAttributeDependencies
- 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_classes')
->key(array(
'pcid' => $values['class'],
'aid' => $aid,
))
->fields(array(
'parent_aid' => $attribute['parent'],
'parent_values' => serialize($attribute['values']),
'required' => $attribute['required'],
))
->execute();
}
parent::submitForm($form, $form_state);
}