You are here

function fontscom_api_form_font_settings_submit in @font-your-face 8.3

Submits Font settings form data.

1 string reference to 'fontscom_api_form_font_settings_submit'
fontscom_api_form_font_settings_alter in modules/fontscom_api/fontscom_api.module
Implements hook_form_alter().

File

modules/fontscom_api/fontscom_api.module, line 116
Fonts.com API module file.

Code

function fontscom_api_form_font_settings_submit(&$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();
  $config = \Drupal::configFactory()
    ->getEditable('fontscom_api.settings');
  $config
    ->set('token', $values['fontscom_api_token']);
  if (isset($values['fontscom_api_project'])) {
    $config
      ->set('project', $values['fontscom_api_project']);
  }
  $config
    ->save();
  fontscom_api_get_allowed_api_filters(TRUE);
  fontscom_api_get_all_remote_fonts_count(TRUE);
  Drupal::messenger()
    ->addMessage(t('Saved Fonts.com Authentication Key'));
}