You are here

function d3_preprocess_d3 in d3.js 7

Implements hook_preprocess_d3() for d3.tpl.php.

File

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

Code

function d3_preprocess_d3(&$variables) {

  // Let drupal_attributes render this.
  $variables['classes_array'][] = $variables['type'];
  $variables['attributes_array']['id'] = array(
    $variables['vis_id'],
  );
  $library = isset($variables['library']) ? $variables['library'] : FALSE;

  // Let's look for a template file in the library definition.
  if (isset($library['template'])) {
    $variables['theme_hook_suggestion'] = isset($library['library name']) ? $library['library name'] : str_replace('.', '_', $library['machine name']);
  }
}