You are here

function _wsclient_ui_property_row in Web service client 7

Generates a row in the properties table.

1 call to _wsclient_ui_property_row()
wsclient_ui_type in wsclient_ui/wsclient_ui.inc
Data type form.

File

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

Code

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

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