You are here

function __forena_load_provider in Forena Reports 7

Same name and namespace in other branches
  1. 6 forena.common.inc \__forena_load_provider()

Load the data provider class based on the class name.

Parameters

string $name:

Return value

object The data provider object

1 call to __forena_load_provider()
__forena_load_repository in ./forena.common.inc

File

./forena.common.inc, line 139
Common functions used throughout the project but loaded in this file to keep the module file lean.

Code

function __forena_load_provider($conf, $repo_path) {
  @($name = isset($conf['data provider']) ? $conf['data provider'] : $conf['data_engine']);
  forena_define_plugins();

  // Instantiate the path

  //drupal_set_message("conf: <pre>". print_r($conf, 1) ."</pre>  repo_path: <pre>". print_r($repo_path,1) ."</pre>");
  if (class_exists($name)) {
    $o = new $name($conf, $repo_path);
    return $o;
  }
  else {
    drupal_set_message(t('Data provider %s not found', array(
      '%s' => $name,
    )), 'error');
  }
}