1 views_ui.theme.inc theme_views_ui_reorder_displays_form($variables)

Turn the reorder form into a proper table

File

core/modules/views_ui/views_ui.theme.inc, line 59
Theme functions for the Views UI module.

Code

function theme_views_ui_reorder_displays_form($variables) {
  $form = $variables['form'];
  $rows = array();
  foreach (element_children($form) as $key) {
    if (isset($form[$key]['#display'])) {
      $display = &$form[$key];

      $row = array();
      $row[] = backdrop_render($display['title']);
      $form[$key]['weight']['#attributes']['class'] = array('weight');
      $row[] = backdrop_render($form[$key]['weight']);
      if (isset($display['removed'])) {
        $row[] = backdrop_render($form[$key]['removed']) .
          l('<span>' . t('Remove') . '</span>', 
          'javascript:void()', 
          array(
            'attributes' => array(
              'id' => 'display-remove-link-' . $key,
              'class' => array('views-button-remove display-remove-link'),
              'alt' => t('Remove this display'),
              'title' => t('Remove this display')),
            'html' => TRUE));
      }
      else {
        $row[] = '';
      }
      $class = array();
      $styles = array();
      if (isset($form[$key]['weight']['#type'])) {
        $class[] = 'draggable';
      }
      if (isset($form[$key]['deleted']['#value']) && $form[$key]['deleted']['#value']) {
        $styles[] = 'display: none;';
      }
      $rows[] = array('data' => $row, 'class' => $class, 'id' => 'display-row-' . $key, 'style' => $styles);
    }
  }

  $header = array(t('Display'), t('Weight'), t('Remove'));
  $output = '';
  backdrop_add_tabledrag('reorder-displays', 'order', 'sibling', 'weight');

  $output = backdrop_render($form['override']);
  $output .= '<div class="scroll">';
  $output .= theme('table', 
  array('header' => $header,
    'rows' => $rows,
    'attributes' => array('id' => 'reorder-displays'),
  ));
  $output .= '</div>';
  $output .= backdrop_render_children($form);

  return $output;
}