public function SettingsForm::submitForm in TinyPNG 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/ SettingsForm.php, line 80
Class
- SettingsForm
- Defines a form that configures forms module settings.
Namespace
Drupal\tinypng\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$values = $form_state
->getValues();
$this
->config('tinypng.settings')
->set('api_key', $values['api_key'])
->set('on_upload', (bool) $values['on_upload'])
->set('upload_method', $values['upload_method'])
->set('image_action', (bool) $values['image_action'])
->save();
}