You are here

public function views_plugin_cache_time::options_form in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 6.3 plugins/views_plugin_cache_time.inc \views_plugin_cache_time::options_form()
  2. 6.2 plugins/views_plugin_cache_time.inc \views_plugin_cache_time::options_form()

Provide a form to edit options for this plugin.

Overrides views_plugin::options_form

File

plugins/views_plugin_cache_time.inc, line 31
Definition of views_plugin_cache_time.

Class

views_plugin_cache_time
Simple caching of query results for Views displays.

Code

public function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $options = array(
    60,
    300,
    1800,
    3600,
    21600,
    518400,
  );
  $options = drupal_map_assoc($options, 'format_interval');
  $options = array(
    -1 => t('Never cache'),
  ) + $options + array(
    'custom' => t('Custom'),
  );
  $form['results_lifespan'] = array(
    '#type' => 'select',
    '#title' => t('Query results'),
    '#description' => t('The length of time raw query results should be cached.'),
    '#options' => $options,
    '#default_value' => $this->options['results_lifespan'],
  );
  $form['results_lifespan_custom'] = array(
    '#type' => 'textfield',
    '#title' => t('Seconds'),
    '#size' => '25',
    '#maxlength' => '30',
    '#description' => t('Length of time in seconds raw query results should be cached.'),
    '#default_value' => $this->options['results_lifespan_custom'],
    '#process' => array(
      'ctools_dependent_process',
    ),
    '#dependency' => array(
      'edit-cache-options-results-lifespan' => array(
        'custom',
      ),
    ),
  );
  $form['output_lifespan'] = array(
    '#type' => 'select',
    '#title' => t('Rendered output'),
    '#description' => t('The length of time rendered HTML output should be cached.'),
    '#options' => $options,
    '#default_value' => $this->options['output_lifespan'],
  );
  $form['output_lifespan_custom'] = array(
    '#type' => 'textfield',
    '#title' => t('Seconds'),
    '#size' => '25',
    '#maxlength' => '30',
    '#description' => t('Length of time in seconds rendered HTML output should be cached.'),
    '#default_value' => $this->options['output_lifespan_custom'],
    '#process' => array(
      'ctools_dependent_process',
    ),
    '#dependency' => array(
      'edit-cache-options-output-lifespan' => array(
        'custom',
      ),
    ),
  );
}