You are here

function charts_graphs_get_graph in Charts and Graphs 7.2

Same name and namespace in other branches
  1. 6.2 charts_graphs.module \charts_graphs_get_graph()
  2. 7 charts_graphs.module \charts_graphs_get_graph()

Factory method that allows instantiating of a charting implementation class by implementation name.

Parameters

<ChartsGraphsCanvas> $name:

Return value

<type>

1 call to charts_graphs_get_graph()
charts_graphs_test in ./charts_graphs.module
For testing and Advanced Help examples.

File

./charts_graphs.module, line 202

Code

function charts_graphs_get_graph($name) {
  $apis = charts_graphs_apis();
  $api = $apis[$name];
  if (!empty($api) && is_object($api)) {
    require_once DRUPAL_ROOT . '/' . $api->path;
    $canvas = new $api->clazz($api->modulename);
    return $canvas;
  }
  else {
    return FALSE;
  }
}