You are here

function d3_get_library_info_handler in d3.js 7

Get a handler object for a library.

Parameters

string $type: The handler type. i.e. 'views'.

Return value

$object Instance of D3LibraryInfoController

See also

hook_library_info_handlers()

3 calls to d3_get_library_info_handler()
D3InfoHandlerTest::setUp in tests/d3_info_handler.test
Sets up unit test environment.
d3_detect_library_info in ./d3.module
Library post-detect callback to process info files before caching.
d3_views_plugin_style_d3::init in modules/d3_views/views/plugins/d3_views_plugin_style_d3.inc
Initialize a style plugin.

File

./d3.module, line 206
D3 module file for creating visualizations with d3.js.

Code

function d3_get_library_info_handler($key = 'default') {
  static $handlers;
  if (!$handlers) {
    $handlers = d3_get_library_info_handlers_info();
  }
  $handler = !empty($handlers[$key]) ? $handlers[$key] : $handlers['default'];
  if (class_exists($handler['controller'])) {

    // Instantiate controller class.
    $controller = new $handler['controller']($handler);
    if ($controller instanceof D3LibraryInfoController) {

      // These are the info file keys that will be processed.
      $controller->processor
        ->setKeys(array(
        $key,
      ));
    }
  }
  return $controller;
}