You are here

function fontawesome_admin_settings_form_submit in Font Awesome Icons 7.3

Implements hook_form_submit().

1 string reference to 'fontawesome_admin_settings_form_submit'
fontawesome_admin_settings_form in ./fontawesome.admin.inc
Settings form for administering module.

File

./fontawesome.admin.inc, line 183
Administrative pages for the Font Awesome module.

Code

function fontawesome_admin_settings_form_submit($form, &$form_state) {

  // Load the library.
  $library = libraries_load(FONTAWESOME_LIBRARY . '_' . $form_state['values']['fontawesome_method']);

  // Use default values if CDN is checked and the locations are blank.
  if ($form_state['values']['fontawesome_external']['use_cdn']) {
    if (empty($form_state['values']['fontawesome_external']['external_location']) || $form_state['values']['fontawesome_external']['external_location'] == $library['cdn url']['webfonts'] || $form_state['values']['fontawesome_external']['external_location'] == $library['cdn url']['svg']) {

      // Choose the default depending on method.
      if ($form_state['values']['fontawesome_method'] == 'webfonts') {
        $form_state['values']['fontawesome_external']['external_location'] = $library['cdn url']['webfonts'];
      }
      else {
        $form_state['values']['fontawesome_external']['external_location'] = $library['cdn url']['svg'];
      }
    }
    if ($form_state['values']['fontawesome_shim']['use_shim'] && empty($form_state['values']['fontawesome_shim']['external_location'])) {
      $form_state['values']['fontawesome_shim']['external_location'] = $library['cdn url']['shim'];
    }
  }
}