Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Time.php

function Time::validateOptionsForm

Overrides PluginBase::validateOptionsForm

File

core/modules/views/src/Plugin/views/cache/Time.php, line 127

Class

Time
Simple caching of query results for Views displays.

Namespace

Drupal\views\Plugin\views\cache

Code

public function validateOptionsForm(&$form, FormStateInterface $form_state) {
    $custom_fields = [
        'output_lifespan',
        'results_lifespan',
    ];
    foreach ($custom_fields as $field) {
        $cache_options = $form_state->getValue('cache_options');
        if ($cache_options[$field] == 'custom' && !is_numeric($cache_options[$field . '_custom'])) {
            $form_state->setError($form[$field . '_custom'], $this->t('Custom time values must be numeric.'));
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal