function commerce_reports_visualization_display in Commerce Reporting 7.3
Views for commerce orders for report displays.
1 call to commerce_reports_visualization_display()
- commerce_reports_views_default_views in includes/
views/ commerce_reports.views_default.inc - Implements hook_views_default_views().
File
- includes/
views/ commerce_reports.views_default.inc, line 11 - Default views.
Code
function commerce_reports_visualization_display($view, $name, $title, $type = 'block', $base_display = 'default') {
// Retrieve our base display
$default = $view->display[$base_display];
// Add the display
$handler = $view
->new_display($type, $title, $name);
// Disable the pager (show all items)
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
// Setup the custom style plugin
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
$handler->display->display_options['style_plugin'] = 'visualization';
// Set some general settings concerning fields
$handler->display->display_options['defaults']['fields'] = FALSE;
$handler->display->display_options['fields'] = $default->display_options['fields'];
$handler->display->display_options['style_options']['info'] = $default->display_options['style_options']['info'];
foreach ($handler->display->display_options['style_options']['info'] as &$field) {
$field['separator'] = '';
}
foreach ($handler->display->display_options['fields'] as $name => &$field) {
// All fields that are passed to the charting module should have at least a value.
$field['hide_alter_empty'] = 1;
$field['empty'] = '0';
// Get rid of those nasty currency fields. We need raw data!
if (!empty($field['type']) && strstr($field['type'], 'commerce_price')) {
$field['type'] = 'commerce_reports_visualization';
}
}
return $handler;
}