You are here

function views_custom_cache_plugin_cache::options_validate in Views custom cache 7

Validates options form.

Overrides views_plugin::options_validate

File

views/views_custom_cache_plugin_cache.inc, line 116
Views custom cache first argument plugin.

Class

views_custom_cache_plugin_cache
Views caching given view's first argument.

Code

function options_validate(&$form, &$form_state) {
  $custom_fields = array(
    'cache_time',
  );
  foreach ($custom_fields as $field) {
    if ($form_state['values']['cache_options'][$field] == 'custom' && !is_numeric($form_state['values']['cache_options'][$field . '_custom'])) {
      form_error($form[$field . '_custom'], t('Custom time values must be numeric.'));
    }
    if ($form_state['values']['cache_options'][$field] == 'custom' && $form_state['values']['cache_options'][$field . '_custom'] <= 0) {
      $mssg = t('Custom cache time must be greater than zero.');
      form_error($form[$field . '_custom'], $mssg);
    }
  }
}