You are here

function theme_wsclient_ui_property_form in Web service client 7

Themes the data type form for editing the properties.

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

File

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

Code

function theme_wsclient_ui_property_form($variables) {
  $elements = $variables['element'];
  $table['#theme'] = 'table';
  $table['#header'] = array(
    t('Data type'),
    t('Multiple'),
    t('Name'),
    t('Default value'),
    t('Label'),
    t('Allow Null'),
  );
  $table['#attributes']['id'] = 'rules-' . drupal_html_id($elements['#title']) . '-id';
  foreach (element_children($elements['items']) as $key) {
    $element =& $elements['items'][$key];
    $row = array();
    $row[] = array(
      'data' => $element['type'],
    );
    $row[] = array(
      'data' => $element['multiple'],
    );
    $row[] = array(
      'data' => $element['name'],
    );
    $row[] = array(
      'data' => $element['default_value'],
    );
    $row[] = array(
      'data' => $element['label'],
    );
    $row[] = array(
      'data' => $element['allow_null'],
    );
    $row = array(
      'data' => $row,
    ) + $element['#attributes'];
    $table['#rows'][] = $row;
  }
  $elements['items']['#printed'] = TRUE;

  // Theme it like a form item, but with the description above the content.
  $attributes['class'][] = 'form-item';
  $attributes['class'][] = 'rules-variables-form';
  $output = '<div' . drupal_attributes($attributes) . '>' . "\n";
  $output .= theme('form_element_label', $variables);
  if (!empty($elements['#description'])) {
    $output .= ' <div class="description">' . $elements['#description'] . "</div>\n";
  }
  $output .= ' ' . drupal_render($table) . "\n";

  // Add in any further children elements.
  foreach (element_children($elements, TRUE) as $key) {
    $output .= drupal_render($elements[$key]);
  }
  $output .= "</div>\n";
  return $output;
}