You are here

function chart_settings_validate in Google Chart Tools: Image Charts 7

Same name and namespace in other branches
  1. 5 chart.module \chart_settings_validate()
  2. 6 chart.module \chart_settings_validate()

Settings page validation.

File

./chart.module, line 423
Provides primary Drupal hook implementations.

Code

function chart_settings_validate($form, &$form_state) {
  if (!empty($form_state['values']['chart_global_bg']) && !preg_match('/[a-fA-F0-9]{6}/is', $form_state['values']['chart_global_bg'])) {
    form_set_error('chart_global_bg', t('Invalid color. Formatted as RRGGBB with no pound sign.'));
  }
  if (!empty($form_state['values']['chart_max_width']) && !is_numeric($form_state['values']['chart_max_width'])) {
    form_set_error('chart_max_width', t('Width must be an integer.'));
  }
  if (!empty($form_state['values']['chart_max_height']) && !is_numeric($form_state['values']['chart_max_height'])) {
    form_set_error('chart_max_height', t('Height must be an integer.'));
  }
}