diff --git a/weight.module b/weight.module index 33238ef..769a1d9 100644 --- a/weight.module +++ b/weight.module @@ -14,14 +14,14 @@ function weight_preprocess_views_view_table(&$variables) { foreach ($variables['view']->field as $field_key => $field) { if ($field->options['plugin_id'] == 'weight_selector') { - // Check the position of the field list, right position should be > 0. - $weight_right_position = array_search($field_key, array_keys($variables['view']->field)); + // Check if the weight selector is on the first column. + $is_first_column = array_search($field_key, array_keys($variables['view']->field)) > 0 ? false : true; // Add the tabledrag attributes. foreach ($variables['rows'] as $key => $row) { - if (!$weight_right_position) { + if ($is_first_column) { // If the weight selector is the first column move it to the last - // position, in order to make the draggable widget appear. + // column, in order to make the draggable widget appear. $weight_selector = $variables['rows'][$key]['columns'][$field->field]; unset($variables['rows'][$key]['columns'][$field->field]); $variables['rows'][$key]['columns'][$field->field] = $weight_selector;