public function CustomServicesAddForm::submitForm in Shorten URLs 8
Same name and namespace in other branches
- 8.2 modules/shorten_cs/src/Form/CustomServicesAddForm.php \Drupal\shorten_cs\Form\CustomServicesAddForm::submitForm()
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
- modules/
shorten_cs/ src/ Form/ CustomServicesAddForm.php, line 88
Class
- CustomServicesAddForm
- Settings form.
Namespace
Drupal\shorten_cs\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$values = $form_state
->getValues();
$record = array();
foreach (array(
'name',
'url',
'type',
'tag',
) as $key) {
$record[$key] = $values[$key];
}
\Drupal::database()
->insert('shorten_cs')
->fields($record)
->execute();
}