1.20.x views_ui.theme.inc | theme_views_ui_rearrange_form($variables) |
Turn the rearrange form into a proper table
File
- modules/
views_ui/ views_ui.theme.inc, line 121 - Theme functions for the Views UI module.
Code
function theme_views_ui_rearrange_form($variables) {
$form = $variables['form'];
$rows = array();
foreach (element_children($form['fields']) as $id) {
if (isset($form['fields'][$id]['name'])) {
$row = array();
$row[] = backdrop_render($form['fields'][$id]['name']);
$form['fields'][$id]['weight']['#attributes']['class'] = array('weight');
$row[] = backdrop_render($form['fields'][$id]['weight']);
$row[] = backdrop_render($form['fields'][$id]['removed']) . l('<span>' . t('Remove') . '</span>', 'javascript:void()', array('attributes' => array('id' => 'views-remove-link-' . $id, 'class' => array('views-hidden', 'views-button-remove', 'views-remove-link'), 'alt' => t('Remove this item'), 'title' => t('Remove this item')), 'html' => TRUE));
$rows[] = array('data' => $row, 'class' => array('draggable'), 'id' => 'views-row-' . $id);
}
}
if (empty($rows)) {
$rows[] = array(array('data' => t('No fields available.'), 'colspan' => '2'));
}
$header = array('', t('Weight'), t('Remove'));
$output = backdrop_render($form['override']);
$output .= '<div class="scroll" data-backdrop-views-scroll>';
$output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'arrange')));
$output .= '</div>';
$output .= backdrop_render_children($form);
backdrop_add_tabledrag('arrange', 'order', 'sibling', 'weight');
return $output;
}