function theme_values_value_fields in Values 7
Same name and namespace in other branches
- 6 values.module \theme_values_value_fields()
Theme the admin values form.
1 theme call to theme_values_value_fields()
- values_form in ./
values.module - Form for adding a new value set.
File
- ./
values.module, line 670 - API for managing reusable value sets.
Code
function theme_values_value_fields($variables) {
$form = $variables['form'];
$headers = array(
array(
'data' => t('Value'),
'class' => 'value',
),
array(
'data' => t('Remove?'),
'class' => 'remove',
),
array(
'data' => t('Weight'),
'class' => 'weight',
),
);
// Build table rows
$rows = array();
foreach (element_children($form) as $key) {
// No need to print the field title every time
unset($form[$key]['key']['#title'], $form[$key]['value']['#title']);
$row = array();
$row[] = array(
'data' => drupal_render($form[$key]['value']) . drupal_render($form[$key]['key']),
'class' => 'value',
);
$row[] = array(
'data' => drupal_render($form[$key]['remove']),
'class' => 'remove',
);
$form[$key]['weight']['#attributes']['class'] = array(
'values-weight-group',
);
$row[] = drupal_render($form[$key]['weight']);
$rows[$key] = array(
'data' => $row,
'class' => array(
'draggable',
),
);
}
drupal_add_css(drupal_get_path('module', 'values') . '/css/values.css');
drupal_add_tabledrag('values-value-list', 'order', 'sibling', 'values-weight-group');
return theme('table', array(
'header' => $headers,
'rows' => $rows,
'attributes' => array(
'id' => 'values-value-list',
),
)) . drupal_render_children($form);
}