You are here

function theme_wsclient_ui_parameter_form in Web service client 7

Themes the operation form for editing the used parameters.

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

File

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

Code

function theme_wsclient_ui_parameter_form($variables) {
  $elements = $variables['element'];
  $table['#theme'] = 'table';
  $table['#header'] = array(
    t('Data type'),
    t('Multiple'),
    t('Name'),
    t('Default value'),
    t('Required'),
    t('Allow Null'),
    array(
      'data' => t('Weight'),
      'class' => array(
        'tabledrag-hide',
      ),
    ),
  );
  $table['#attributes']['id'] = 'rules-' . drupal_html_id($elements['#title']) . '-id';
  foreach (element_children($elements['items']) as $key) {
    $element =& $elements['items'][$key];

    // Add special classes to be used for tabledrag.js.
    $element['weight']['#attributes']['class'] = array(
      'rules-element-weight',
    );
    $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['required'],
    );
    $row[] = array(
      'data' => $element['allow_null'],
    );
    $row[] = array(
      'data' => $element['weight'],
    );
    $row = array(
      'data' => $row,
    ) + $element['#attributes'];
    $row['class'][] = 'draggable';
    $table['#rows'][] = $row;
  }
  $elements['items']['#printed'] = TRUE;
  if (!empty($table['#rows'])) {
    drupal_add_tabledrag($table['#attributes']['id'], 'order', 'sibling', 'rules-element-weight');
  }

  // 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;
}