You are here

function formassembly_settings_form_validate in FormAssembly 7

Validation callback for the FormAssembly settings form.

File

./formassembly.admin.inc, line 102
Contains FormAssembly admin settings.

Code

function formassembly_settings_form_validate($form, &$form_state) {
  $values = $form_state['values'];
  $client_id = !empty($values['formassembly_oauth_cid']);
  $client_secret = !empty($values['formassembly_oauth_secret']);

  // Check that the user has provided oauth credentials.
  if (!$client_id) {
    $error_message = t('Client ID is required to sync.');
    form_set_error('formassembly_oauth_cid', $error_message);
    watchdog('formassembly', $error_message);
  }
  if (!$client_secret) {
    $error_message = t('Client secret is required to sync.');
    form_set_error('formassembly_oauth_secret', $error_message);
    watchdog('formassembly', $error_message);
  }
}