function theme_filefield_draggable_settings_table in FileField 6.2
Theme function for a file formatter / file widget settings table.
File
- ./
filefield.theme.inc, line 15 - FileField: Defines a CCK file field type.
Code
function theme_filefield_draggable_settings_table($element) {
$settings_type = $element['#settings_type'];
// 'widgets' or 'formatters'?
$table_id = 'filefield-file-' . $settings_type . '-table';
$order_class = 'filefield-file-' . $settings_type . '-weight';
$title = isset($element['#title']) ? $element['#title'] : '';
unset($element['#title']);
// the header is used instead of the regular label
$required = !empty($element['#required']) ? '<span class="form-required" title="' . t('This field is required.') . '">*</span>' : '';
$title_column = t('@title: !required', array(
'@title' => $title,
'!required' => $required,
));
$header = array(
$title_column,
t('Order'),
);
$rows = array();
foreach (element_children($element) as $key) {
$element[$key]['weight']['#attributes']['class'] = $order_class;
$delta_element = drupal_render($element[$key]['weight']);
$row = array(
drupal_render($element[$key]),
$delta_element,
);
$rows[] = array(
'data' => $row,
'class' => 'draggable',
);
}
$output = theme('table', $header, $rows, array(
'id' => $table_id,
));
$output = theme('form_element', $element, $output);
drupal_add_tabledrag($table_id, 'order', 'sibling', $order_class);
return $output;
}