You are here

function d3_graphapi_settings_form in d3.js 7

Implements hook_graphapi_settings_form().

File

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

Code

function d3_graphapi_settings_form($values) {
  $engine = 'd3';
  $form[$engine] = array(
    '#type' => 'fieldset',
    '#title' => 'D3 settings',
  );
  $options = array();
  foreach (d3_get_libraries() as $library) {
    $options[$library['js callback']] = $library['name'];
  }
  $form[$engine]['library'] = array(
    '#title' => 'Default library',
    '#description' => t('Use this d3 library as the default to render graphapi visualizations'),
    '#type' => 'select',
    '#options' => $options,
    '#default_value' => isset($values['library']) ? $values['library'] : key($options),
  );
  return $form;
}