It's pretty annoying that the section field is hardcoded to be displayed after the title in a table view. Isn't there a way to set the weight of the field in the settings of the view itself? There must be a better way to let the configurator decide the placing of the section field... But I'm not shure how this can be best accomplished since it's added in a "hook_views_pre_view"... Anyone got any idea's of how best to handle this?
Code from workbench_access.views.inc on line 126
// Only add a section field and style options if this is a table.
if ($style_plugin == 'table') {
// If the current display uses the default fields, target them.
if ($current_display== 'default' || $view->display[$current_display]->handler->options['defaults']['fields']) {
$fields = &$view->display['default']->handler->options['fields'];
}
// Otherwise, target this display's fields.
else {
$fields = &$view->display[$current_display]->handler->options['fields'];
}
// This temporary variable will take all the values from
// the existing fields array and add a section field after the title.
$new_view_fields = array();
foreach ($fields as $key => $value) {
$new_view_fields[$key] = $value;
if ($key == 'title') {
$new_view_fields['section'] = _workbench_access_views_section_field_definition();
}
}
// Set the new fields array on the actual view.
$fields = $new_view_fields;
$style_options['columns']['section'] = 'section';
$style_options['info']['section'] = array(
// Only do a sortable section column on Views using the node table.
// A PDO error occurs with the node_revisions table.
'sortable' => ($view->base_table == 'node'),
'align' => '',
'separator' => '',
);
}
Comments
Comment #1
agentrickard