You are here

function _charts_settings_form in Charts 7

Same name and namespace in other branches
  1. 6 charts.admin.inc \_charts_settings_form()

Module settings page. Users can set the default layout of their charts.

2 calls to _charts_settings_form()
charts_plugin_style_chart::options_form in views/charts_plugin_style_chart.inc
Generate a form for setting options.
_charts_settings_page in ./charts.admin.inc
Module settings page. Users can set the default layout of their charts.

File

./charts.admin.inc, line 131
@author Bruno Massa http://drupal.org/user/67164

Code

function _charts_settings_form(&$form, $default = array(), $options = array()) {
  module_load_include('inc', 'charts');
  $default = $default + _charts_settings();
  $options = array_fill_keys($options, TRUE);
  if (!empty($options['example'])) {
    $form['chart_example'] = array(
      '#value' => _charts_example(),
    );
  }
  asort($default['#plugins']);
  $form['plugin'] = array(
    '#default_value' => $default['#plugin'],
    '#options' => $default['#plugins'],
    '#required' => TRUE,
    '#type' => 'select',
    '#title' => t('Chart plugin'),
  );
  asort($default['#types']);
  $form['type'] = array(
    '#default_value' => $default['#type'],
    '#options' => $default['#types'],
    '#required' => TRUE,
    '#type' => 'radios',
    '#title' => t('Chart type'),
  );
  $form['width'] = array(
    '#default_value' => $default['#width'],
    '#description' => t('The chart width, in pixels'),
    '#required' => TRUE,
    '#size' => 8,
    '#type' => 'textfield',
    '#title' => t('Width'),
  );
  $form['height'] = array(
    '#default_value' => $default['#height'],
    '#description' => t('The chart height, in pixels'),
    '#required' => TRUE,
    '#size' => 8,
    '#type' => 'textfield',
    '#title' => t('Height'),
  );
  if (empty($options['color_complete'])) {
    _charts_color_form_simple($form, $default);
  }
  else {
    _charts_color_form_complete($form, $default);
  }
  return $form;
}