You are here

public function SettingsForm::submitForm in Field Defaults 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 FormInterface::submitForm

File

src/Form/SettingsForm.php, line 81

Class

SettingsForm
Class SettingsForm.

Namespace

Drupal\field_defaults\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this->configFactory
    ->getEditable('field_defaults.configuration');
  $config
    ->set('update_date', $form_state
    ->getValue('update_date'));
  $settings = $config
    ->save();
  if ($settings) {
    $this
      ->messenger()
      ->addMessage($this
      ->t('Settings saved'));
  }
}