function d3_get_libraries in d3.js 7
Provides an array of d3 libraries.
D3 libraries are going to have a prefix of d3., see README.txt for information on creating a custom d3 library.
3 calls to d3_get_libraries()
- d3_graphapi_settings_form in ./
d3.module - Implements hook_graphapi_settings_form().
- d3_libraries_info_alter in ./
d3.module - Implements hook_libraries_info_alter().
- d3_views_plugin_style_d3::getLibraries in modules/
d3_views/ views/ plugins/ d3_views_plugin_style_d3.inc - Get d3 libraries basic info.
File
- ./
d3.module, line 455 - D3 module file for creating visualizations with d3.js.
Code
function d3_get_libraries() {
static $d3_libraries;
if ($d3_libraries) {
return $d3_libraries;
}
// Returns all libraries in the default folders.
$libraries = libraries_info();
foreach ($libraries as $library) {
$library_name = $library['machine name'];
// Filter out any other non-d3 library. All d3 libraries should have
// the prefix "d3.".
if (strpos($library_name, 'd3.') === FALSE) {
continue;
}
// Do not list these default extension libraries.
if (in_array($library_name, array(
'd3.extend',
'd3.tooltip',
'd3.drupal',
))) {
continue;
}
$d3_libraries[$library_name] = $library;
$d3_libraries[$library_name]['js callback'] = str_replace('d3.', '', $library_name);
}
return $d3_libraries;
}