You are here

function _wsclient_ui_parameter_row in Web service client 7

Generates a row in the parameter table.

1 call to _wsclient_ui_parameter_row()
wsclient_ui_operation in wsclient_ui/wsclient_ui.inc
Operation form.

File

wsclient_ui/wsclient_ui.inc, line 711
WSClient UI - implements service description management and configuration screens.

Code

function _wsclient_ui_parameter_row($service, $types, $name = '', $info = array()) {
  $param_type = 0;
  $multiple = FALSE;
  if (isset($info['type'])) {
    $param_type = wsclient_map_type($service->name, $service
      ->dataTypes(), $info['type']);
    if (strpos($param_type, 'list<') === 0) {
      $multiple = TRUE;

      // Cut off the 'list<>' indicator.
      $param_type = substr($param_type, 5, -1);
    }
  }
  $parameter['type'] = array(
    '#type' => 'select',
    '#options' => array(
      0 => '--',
    ) + $types,
    '#default_value' => $param_type,
  );
  $parameter['multiple'] = array(
    '#type' => 'checkbox',
    '#default_value' => $multiple,
  );
  $parameter['name'] = array(
    '#type' => 'textfield',
    '#size' => 40,
    '#default_value' => $name,
    '#element_validate' => array(
      'wsclient_ui_name_validate',
    ),
  );
  $parameter['default_value'] = array(
    '#type' => 'textfield',
    '#size' => 30,
    '#default_value' => isset($info['default value']) ? $info['default value'] : '',
  );
  $parameter['required'] = array(
    '#type' => 'checkbox',
    '#default_value' => isset($info['optional']) ? !$info['optional'] : TRUE,
  );
  $parameter['allow_null'] = array(
    '#type' => 'checkbox',
    '#default_value' => isset($info['allow null']) ? $info['allow null'] : FALSE,
  );
  $parameter['weight'] = array(
    '#type' => 'weight',
  );
  return $parameter;
}