You are here

function _charts_color_form_complete in Charts 6

Same name and namespace in other branches
  1. 7 charts.admin.inc \_charts_color_form_complete()

Subform that integartes Color module with Charts settings. Its called inside the Charts settings page, by _charts_settings().

1 call to _charts_color_form_complete()
_charts_settings_form in ./charts.admin.inc
Module settings page. Users can set the default layout of their charts.

File

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

Code

function _charts_color_form_complete(&$form, $default) {

  // Use ColorPicker module if possible
  $field_type = module_exists('colorpicker') ? 'colorpicker_textfield' : 'textfield';
  $form['color'] = array(
    '#type' => 'fieldset',
    '#title' => t('Color'),
    '#tree' => TRUE,
  );
  $form['color']['color_palette'] = array(
    '#type' => 'select',
    '#title' => t('Color palettes'),
    '#options' => $default['#color_palettes'],
    '#default_value' => $default['#color_palette'],
  );
  $form['color']['background'] = array(
    //     '#colorpicker'    => 'colorpicker',
    '#default_value' => $default['#color']['background'],
    '#title' => t('Background'),
    '#type' => $field_type,
  );
  $form['color']['text'] = array(
    '#default_value' => $default['#color']['text'],
    '#required' => TRUE,
    '#title' => t('Text'),
    '#type' => $field_type,
  );
  for ($series = 0; $series < 8; $series++) {
    $form['color'][$series] = array(
      '#default_value' => $default['#color'][$series],
      '#required' => TRUE,
      '#title' => t('Series %serie', array(
        '%serie' => $series + 1,
      )),
      '#type' => $field_type,
    );
  }
  drupal_add_js(drupal_get_path('module', 'charts') . '/charts_color.js');
  drupal_add_js(array(
    'chartsColorCustom' => t('Custom'),
  ), 'setting');
}