public function CustomFormattersSettingsForm::submitForm in Custom Formatters 8.3
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/ CustomFormattersSettingsForm.php, line 68
Class
- CustomFormattersSettingsForm
- Configure update settings for this site.
Namespace
Drupal\custom_formatters\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$this
->messenger()
->addStatus($this
->t('Custom Formatters settings have been updated.'));
$config = $this
->config('custom_formatters.settings');
$config
->set('label_prefix', $form_state
->getValue('label_prefix'))
->set('label_prefix_value', $form_state
->getValue('label_prefix_value'))
->save();
// Clear cached formatters.
// @TODO - Tag custom formatters?
\Drupal::service('plugin.manager.field.formatter')
->clearCachedDefinitions();
}