function formassembly_settings_form_submit in FormAssembly 7
Submit handler for the FormAssembly settings form.
File
- ./
formassembly.admin.inc, line 123 - Contains FormAssembly admin settings.
Code
function formassembly_settings_form_submit($form, &$form_state) {
$values = $form_state['values'];
_formassembly_save_vars($values);
$client_id = $values['formassembly_oauth_cid'];
// Deleting this variable is enough to generate a new access_token.
if ($values['formassembly_reauthorize']) {
variable_del('formassembly_oauth_access_token');
}
$request = new FormAssemblyRequest($client_id);
$token = $request
->authorize();
$request
->setToken($token);
if ($values['batch_sync_formassembly']) {
//Setup a batch
$batch = array(
'operations' => array(
array(
'formassembly_batch_get_forms',
array(
$values['formassembly_admin_index'],
),
),
array(
'formassembly_batch_extract_forms',
array(),
),
),
'finished' => 'formassembly_batch_get_finished',
'title' => 'Request Forms Data from FormAssembly',
'init_message' => 'Contacting FormAssembly',
);
batch_set($batch);
}
drupal_set_message('FormAssembly configuration saved.');
}