You are here

function forena_report_general_form_validate in Forena Reports 8

Same name and namespace in other branches
  1. 7.5 forena.report.inc \forena_report_general_form_validate()
  2. 7.4 forena.report.inc \forena_report_general_form_validate()

File

./forena.report.inc, line 454

Code

function forena_report_general_form_validate($form, &$form_state) {
  $values = $form_state['values'];
  if ($values['menu']['path']) {
    if (!valid_url(str_replace(':', '', $values['menu']['path']), FALSE)) {
      form_set_error('menu][path', t('Invalid Path'));
    }
  }
  if ($values['cache']['duration']) {
    try {
      $time = @new DateTime($values['cache']['duration']);
    } catch (Exception $e) {
    }
    if (!$time) {
      form_set_error('cache][duration', t('Invalid Cache Duration'));
    }
  }
}