function weight_preprocess_views_view_table in Weight 7.2
Same name and namespace in other branches
- 8.3 weight.module \weight_preprocess_views_view_table()
- 7.3 weight.module \weight_preprocess_views_view_table()
Implementes hook_preprocess_views_view_table().
File
- ./
weight.module, line 568
Code
function weight_preprocess_views_view_table(&$variables) {
// If there isn't a Weight field or the user doesn't have access to it, don't do anything.
if (!array_key_exists('weight', $variables['fields']) || !user_access('assign node weight')) {
return;
}
// Add the tabledrag attributes.
$vars['classes_array'][] = 'draggable';
foreach ($variables['rows'] as $key => $row) {
$variables['row_classes'][$key][] = 'draggable';
}
$table_id = 'weight-table-' . $variables['id'];
$variables['attributes_array']['id'] = $table_id;
drupal_add_tabledrag($table_id, 'order', 'sibling', 'weight-weight');
}