You are here

function wsconfig_context_wsconfig_settings_form in Web Service Data 7

1 string reference to 'wsconfig_context_wsconfig_settings_form'
wsconfig.inc in modules/wsconfig/plugins/contexts/wsconfig.inc

File

modules/wsconfig/plugins/contexts/wsconfig.inc, line 27

Code

function wsconfig_context_wsconfig_settings_form($form, &$form_state) {
  $conf =& $form_state['conf'];
  $form['wsconfig'] = array(
    '#type' => 'select',
    '#title' => t('Web Service Config'),
    '#description' => t('The web service config to use to retrieve the data'),
    '#options' => wsconfig_get_list_by_name(),
    '#default_value' => $conf['wsconfig'],
  );
  foreach (wsconfig_get_list_by_name() as $machinename => $name) {
    $wsconfig = wsconfig_load_by_name($machinename);
    $items = array();
    foreach ($wsconfig
      ->getOperations() as $opname) {
      $items[$opname] = $wsconfig
        ->getMethodName($opname);
    }
    $form['wsconfig_method_' . $machinename] = array(
      '#type' => 'select',
      '#title' => t('Web Service Config Method'),
      '#description' => t('The web service method to use'),
      '#options' => $items,
      '#default_value' => $conf['wsconfig_method_' . $machinename],
      '#states' => array(
        'visible' => array(
          ':input[name="wsconfig"]' => array(
            'value' => $machinename,
          ),
        ),
      ),
    );
  }
  $form['replacements'] = array(
    '#type' => 'textfield',
    '#title' => t('Replacements'),
    '#description' => t('Replacements'),
    '#default_value' => $conf['replacements'],
  );
  $form['arguments'] = array(
    '#type' => 'textfield',
    '#title' => t('Arguments'),
    '#description' => t('JSON encoded arguments to pass to the wsconfig'),
    '#default_value' => $conf['arguments'],
  );
  $form['options'] = array(
    '#type' => 'textfield',
    '#title' => t('Options'),
    '#description' => t('JSON encoded options'),
    '#default_value' => $conf['options'],
  );
  $form['wsprocessor'] = array(
    '#type' => 'select',
    '#title' => t('Web Service Processor'),
    '#description' => t('The web service processor to parse the data'),
    '#options' => wsconfig_get_data_processors(),
    '#default_value' => $conf['wsprocessor'],
  );
  return $form;
}