You are here

public function Time::validateOptionsForm in Views (for Drupal 7) 8.3

Validate the options form.

Overrides PluginBase::validateOptionsForm

File

lib/Drupal/views/Plugin/views/cache/Time.php, line 90
Definition of Drupal\views\Plugin\views\cache\Time.

Class

Time
Simple caching of query results for Views displays.

Namespace

Drupal\views\Plugin\views\cache

Code

public function validateOptionsForm(&$form, &$form_state) {
  $custom_fields = array(
    'output_lifespan',
    'results_lifespan',
  );
  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.'));
    }
  }
}