You are here

function theme_wsclient_ui_header_form in Web service client 7

Themes the operation form for editing the used headers.

Just cloned from theme_wsclient_ui_parameter_form()

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

File

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

Code

function theme_wsclient_ui_header_form($variables) {
  $elements = $variables['element'];
  $table['#theme'] = 'table';
  $table['#header'] = array(
    t('Namespace'),
    t('Name'),
    t('Data'),
    t('Mustunderstand'),
    t('Actor'),
    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['namespace'],
    );
    $row[] = array(
      'data' => $element['name'],
    );
    $row[] = array(
      'data' => $element['data'],
    );
    $row[] = array(
      'data' => $element['mustunderstand'],
    );
    $row[] = array(
      'data' => $element['actor'],
    );
    $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;
}