You are here

function visualization_plugin in Visualization API 7

Same name and namespace in other branches
  1. 8 visualization.module \visualization_plugin()

Returns the name of the library that should be used to render a chart.

Optionally one can pass a chart type to get the best library available for that type.

1 call to visualization_plugin()
template_preprocess_visualization in theme/visualization.theme.inc
Preprocess function for visualization function.

File

./visualization.module, line 108
The helper functions for the visualization part of the module.

Code

function visualization_plugin($type = FALSE) {
  ctools_include('plugins');
  $plugins = ctools_get_plugins('visualization', 'library');
  $preferred_plugin = variable_get('visualization', 'gva');
  if (!empty($plugins[$preferred_plugin]) && $plugins[$preferred_plugin]['handler']
    ->available() && (!empty($type) && in_array($type, $plugins[$preferred_plugin]['handler']
    ->supportedTypes()))) {
    return $plugins[$preferred_plugin];
  }
  else {
    return reset($plugins);
  }
}