You are here

function _charts_settings_form in Charts 6

Same name and namespace in other branches
  1. 7 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 135
@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();
  asort($default['#plugins']);
  asort($default['#types']);
  $options = array_fill_keys($options, TRUE);
  if (!empty($options['example'])) {
    foreach ($default['#types'] as $type => $name) {
      $form['chart_example' . $type] = array(
        '#value' => _charts_example($type, $name),
      );
    }
  }
  $form['plugin'] = array(
    '#default_value' => $default['#plugin'],
    '#options' => $default['#plugins'],
    '#required' => TRUE,
    '#type' => 'select',
    '#title' => t('Chart plugin'),
  );
  $form['type'] = array(
    '#default_value' => $default['#type'],
    '#options' => $default['#types'],
    '#required' => TRUE,
    '#type' => 'radios',
    '#title' => t('Chart type'),
  );
  $form['size'] = array(
    '#description' => t('The chart size, in pixels'),
    '#type' => 'fieldset',
    '#title' => t('Size'),
  );
  $form['size']['width'] = array(
    '#default_value' => $default['#width'],
    '#required' => TRUE,
    '#size' => 8,
    '#type' => 'textfield',
    '#title' => t('Width'),
  );
  $form['size']['height'] = array(
    '#default_value' => $default['#height'],
    '#required' => TRUE,
    '#size' => 8,
    '#type' => 'textfield',
    '#title' => t('Height'),
  );
  $form['label'] = array(
    '#default_value' => $default['#label'],
    '#type' => 'checkbox',
    '#title' => t('Display value label'),
  );
  $form['legend'] = array(
    '#default_value' => $default['#legend'],
    '#type' => 'checkbox',
    '#title' => t('Display series legend'),
  );
  if (empty($options['color_complete'])) {
    _charts_color_form_simple($form, $default);
  }
  else {
    _charts_color_form_complete($form, $default);
  }
  return $form;
}