You are here

function theme_mvf_column_order in Measured Value Field 7

Default theme implementation of hook 'mvf_column_order'.

Render form element into a table with JS draggable weight fields.

Parameters

array $vars: Arguments for theming

Return value

string Themed HTML string of the supplied arguments

1 theme call to theme_mvf_column_order()
mvf_field_widget_settings_form in ./mvf.module
Implements hook_field_widget_settings_form().

File

./mvf.module, line 1529
Define a field type of measured value.

Code

function theme_mvf_column_order($vars) {
  $element = $vars['element'];
  $header = array(
    'Column',
    'Weight',
    'Extra Settings',
  );
  $rows = array();
  $table_id = 'mvf-column-order-table';
  $group = 'mvf-order';
  foreach (element_children($element) as $key) {
    if (!isset($element[$key]['weight']['#attributes']['class'])) {
      $element[$key]['weight']['#attributes']['class'] = array();
    }
    $element[$key]['weight']['#attributes']['class'][] = $group;
    $rows[] = array(
      'data' => array(
        drupal_render($element[$key]['column']),
        drupal_render($element[$key]['weight']),
        drupal_render($element[$key]),
      ),
      'class' => array(
        'draggable',
      ),
    );
  }
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'attributes' => array(
      'id' => $table_id,
    ),
    'caption' => t('Order of Fields'),
  ));
  $output .= drupal_render_children($element);
  drupal_add_tabledrag($table_id, 'order', 'sibling', $group);
  return $output;
}