You are here

function _charts_settings_page_submit in Charts 6

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

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

File

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

Code

function _charts_settings_page_submit(&$form, &$form_state) {
  $settings = $form_state['values'];

  // Discart all form values non related to charts
  unset($settings['submit']);
  unset($settings['form_id']);
  unset($settings['form_build_id']);
  unset($settings['form_token']);
  unset($settings['op']);

  // Unwanted values
  unset($settings['color']['color_palette']);

  // Include a # sign in all attributes, because it will make the
  // merge between the chart data and the defaults easier on every
  // chart display.
  foreach ($settings as $index => $value) {
    $default['#' . $index] = $value;
  }

  // Save the data into database
  variable_set('charts_settings', $default);
}