You are here

function formassembly_settings_form in FormAssembly 7

Page callback for the FormAssembly settings form.

1 string reference to 'formassembly_settings_form'
formassembly_menu in ./formassembly.module
Implements hook_menu().

File

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

Code

function formassembly_settings_form() {
  $form = array();
  $key = 'formassembly_oauth_cid';
  $form[$key] = array(
    '#type' => 'textfield',
    '#required' => FALSE,
    '#title' => t('FormAssembly OAuth Client ID'),
    '#description' => t('The client ID.'),
    '#default_value' => variable_get($key, ''),
  );
  $key = 'formassembly_oauth_secret';
  $form[$key] = array(
    '#type' => 'textfield',
    '#required' => FALSE,
    '#title' => t('FormAssembly OAuth Client Secret'),
    '#description' => t('The client secret.'),
    '#default_value' => variable_get($key, ''),
  );
  $key = 'formassembly_endpoint';
  $form[$key] = array(
    '#type' => 'select',
    '#title' => t('API Endpoint'),
    '#required' => TRUE,
    '#description' => t('Select the endpoint for API requests.'),
    '#options' => array(
      'dev' => t('Developer Sandbox'),
      'pro' => t('FormAssembly.com'),
      'ent' => t('FormAssembly Enterprise Cloud'),
    ),
    '#default_value' => variable_get($key, 'pro'),
  );
  $key = 'formassembly_instance';
  $form[$key] = array(
    '#type' => 'textfield',
    '#required' => FALSE,
    '#title' => t('Enterprise Cloud Subdoman'),
    '#description' => t('<em>subdomain</em>.tfaforms.net'),
    '#default_value' => variable_get($key, ''),
    '#states' => array(
      'visible' => array(
        ':input[name="formassembly_endpoint"]' => array(
          'value' => 'ent',
        ),
      ),
    ),
  );
  $key = 'formassembly_admin_index';
  $form[$key] = array(
    '#type' => 'checkbox',
    '#required' => FALSE,
    '#title' => t('Admin Index'),
    '#description' => t('Select to return a list of all forms in the FormAssembly instance. The authentication tokens entered above must be from an admin-level user'),
    '#default_value' => variable_get($key, FALSE),
    '#states' => array(
      'visible' => array(
        ':input[name="formassembly_endpoint"]' => array(
          'value' => 'ent',
        ),
      ),
    ),
  );
  $form['batch_sync_formassembly'] = array(
    '#type' => 'checkbox',
    '#title' => t('Sync now'),
    '#description' => t('Sync forms after submitting this form.'),
    '#default_value' => FALSE,
    '#suffix' => '<div>' . t('To sync on cron, place the drush command %command into your crontab.  See !url for more information.', array(
      '%command' => 'drush fa-sync',
      '!url' => l('https://www.drupal.org/node/1294438', 'https://www.drupal.org/node/1294438'),
    )) . '</div>',
  );
  $form['formassembly_reauthorize'] = array(
    '#type' => 'checkbox',
    '#title' => t('Reauthorize'),
    '#description' => t('Reauthorize this application and get a new access token.'),
    '#default_value' => FALSE,
  );
  $form['save'] = array(
    '#type' => 'submit',
    '#value' => t('Submit'),
  );
  return $form;
}