function theme_views_ui_rearrange_form in Views (for Drupal 7) 6.2
Same name and namespace in other branches
- 8.3 views_ui/theme/theme.inc \theme_views_ui_rearrange_form()
- 6.3 includes/admin.inc \theme_views_ui_rearrange_form()
- 7.3 includes/admin.inc \theme_views_ui_rearrange_form()
Turn the rearrange form into a proper table
File
Code
function theme_views_ui_rearrange_form($form) {
$rows = array();
foreach (element_children($form['fields']) as $id) {
if (isset($form['fields'][$id]['name'])) {
$row = array();
$row[] = drupal_render($form['fields'][$id]['name']);
$form['fields'][$id]['weight']['#attributes']['class'] = 'weight';
$row[] = drupal_render($form['fields'][$id]['weight']);
$row[] = drupal_render($form['fields'][$id]['removed']) . l('<span>' . t('Remove') . '</span>', 'javascript:void()', array(
'attributes' => array(
'id' => 'views-remove-link-' . $id,
'class' => 'views-button-remove views-remove-link',
'alt' => t('Remove this item'),
'title' => t('Remove this item'),
),
'html' => true,
));
$rows[] = array(
'data' => $row,
'class' => 'draggable',
'id' => 'views-row-' . $id,
);
}
}
if (empty($rows)) {
$rows[] = array(
array(
'data' => t('No fields available.'),
'colspan' => '2',
),
);
}
$header = array(
'',
t('Weight'),
t('Remove'),
);
drupal_add_tabledrag('arrange', 'order', 'sibling', 'weight');
$output = drupal_render($form['override']);
$output .= theme('table', $header, $rows, array(
'id' => 'arrange',
));
$output .= drupal_render($form);
return $output;
}