diff --git a/core/modules/views/views_ui/lib/Drupal/views_ui/Form/Ajax/Rearrange.php b/core/modules/views/views_ui/lib/Drupal/views_ui/Form/Ajax/Rearrange.php
index de01217fb31..d2115c8e924 100644
--- a/core/modules/views/views_ui/lib/Drupal/views_ui/Form/Ajax/Rearrange.php
+++ b/core/modules/views/views_ui/lib/Drupal/views_ui/Form/Ajax/Rearrange.php
@@ -74,23 +74,23 @@ class Rearrange extends ViewsFormBase {
$relationships[$id] = $handler->label();
}
- // Filters can now be grouped so we do a little bit extra:
- $groups = array();
- $grouping = FALSE;
- if ($type == 'filter') {
- $group_info = $executable->display_handler->getOption('filter_groups');
- if (!empty($group_info['groups']) && count($group_info['groups']) > 1) {
- $grouping = TRUE;
- $groups = array(0 => array());
- }
- }
+ $form['fields'] = array(
+ '#type' => 'table',
+ '#header' => array('', t('Weight'), t('Remove')),
+ '#empty' => t('No fields available.'),
+ '#tabledrag' => array(
+ array('order', 'sibling', 'weight'),
+ ),
+ '#tree' => TRUE,
+ '#prefix' => '
',
+ '#suffix' => '
',
+ );
foreach ($display->getOption($types[$type]['plural']) as $id => $field) {
- $form['fields'][$id] = array('#tree' => TRUE);
- $form['fields'][$id]['weight'] = array(
- '#type' => 'textfield',
- '#default_value' => ++$count,
- );
+ $form['fields'][$id] = array();
+
+ $form['fields'][$id]['#attributes'] = array('class' => array('draggable'), 'id' => 'views-row-' . $id);
+
$handler = $display->getHandler($type, $id);
if ($handler) {
$name = $handler->adminLabel() . ' ' . $handler->adminSummary();
@@ -105,30 +105,29 @@ class Rearrange extends ViewsFormBase {
else {
$form['fields'][$id]['name'] = array('#markup' => t('Broken field @id', array('@id' => $id)));
}
+
+ $form['fields'][$id]['weight'] = array(
+ '#type' => 'textfield',
+ '#default_value' => ++$count,
+ '#attributes' => array('class' => array('weight')),
+ );
+
$form['fields'][$id]['removed'] = array(
'#type' => 'checkbox',
'#id' => 'views-removed-' . $id,
'#attributes' => array('class' => array('views-remove-checkbox')),
'#default_value' => 0,
+ '#suffix' => l('' . t('Remove') . '', '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)),
);
}
- // Add javascript settings that will be added via $.extend for tabledragging
- $form['#js']['tableDrag']['arrange']['weight'][0] = array(
- 'target' => 'weight',
- 'source' => NULL,
- 'relationship' => 'sibling',
- 'action' => 'order',
- 'hidden' => TRUE,
- 'limit' => 0,
- );
-
$name = NULL;
if (isset($form_state['update_name'])) {
$name = $form_state['update_name'];
}
$view->getStandardButtons($form, $form_state, 'views_ui_rearrange_form');
+
return $form;
}
diff --git a/core/modules/views/views_ui/views_ui.theme.inc b/core/modules/views/views_ui/views_ui.theme.inc
index 2f92bdd49e4..841f15ccc7f 100644
--- a/core/modules/views/views_ui/views_ui.theme.inc
+++ b/core/modules/views/views_ui/views_ui.theme.inc
@@ -242,38 +242,6 @@ function theme_views_ui_reorder_displays_form($vars) {
return $output;
}
-/**
- * Turn the rearrange form into a proper table
- */
-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[] = drupal_render($form['fields'][$id]['name']);
- $form['fields'][$id]['weight']['#attributes']['class'] = array('weight');
- $row[] = drupal_render($form['fields'][$id]['weight']);
- $row[] = drupal_render($form['fields'][$id]['removed']) . l('' . t('Remove') . '', '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 = drupal_render($form['override']);
- $output .= '';
- $output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'arrange')));
- $output .= '
';
- $output .= drupal_render_children($form);
- drupal_add_tabledrag('arrange', 'order', 'sibling', 'weight');
-
- return $output;
-}
-
/**
* Turn the rearrange form into a proper table
*/