You are here

function views_content_cache_plugin_cache::options_form in Views content cache 7.3

Same name and namespace in other branches
  1. 6.2 views/views_content_cache_plugin_cache.inc \views_content_cache_plugin_cache::options_form()

Provide a form to edit options for this plugin.

Overrides views_plugin::options_form

File

views/views_content_cache_plugin_cache.inc, line 31
Provides the Views content cache, views cache plugin.

Class

views_content_cache_plugin_cache
Simple caching of query results for Views displays. Includes listening for changes/posts/deletions of certain node types.

Code

function options_form(&$form, &$form_state) {
  $form['keys'] = array(
    '#title' => t('Cache segments'),
    '#type' => 'fieldset',
    '#description' => t("Choose which events will update this View's cache."),
  );
  foreach (views_content_cache_get_plugin() as $key_id => $plugin) {
    $option_value = isset($this->options['keys'][$key_id]) ? $this->options['keys'][$key_id] : array();
    $form['keys'][$key_id] = $plugin
      ->options_form($option_value, $this);
  }
  $options = array(
    60,
    300,
    1800,
    3600,
    21600,
    518400,
  );
  $options = drupal_map_assoc($options, 'format_interval');
  $options = array(
    -1 => t('None'),
  ) + $options;
  $form['results_min_lifespan'] = array(
    '#type' => 'select',
    '#title' => t('Query results - Minimum lifetime'),
    '#description' => t('Query results will be cached for <strong>at least</strong> this amount of time, even if a selected event has occured more recently.'),
    '#options' => $options,
    '#default_value' => $this->options['results_min_lifespan'],
  );
  $form['results_max_lifespan'] = array(
    '#type' => 'select',
    '#title' => t('Query results - Maximum lifetime'),
    '#description' => t('Query results will be cached for <strong>at most</strong> this amount of time.'),
    '#options' => $options,
    '#default_value' => $this->options['results_max_lifespan'],
  );
  $form['output_min_lifespan'] = array(
    '#type' => 'select',
    '#title' => t('Rendered output - Minimum lifetime'),
    '#description' => t('Rendered HTML output will be cached for <strong>at least</strong> this amount of time, even if a selected event has occured more recently.'),
    '#options' => $options,
    '#default_value' => $this->options['output_min_lifespan'],
  );
  $form['output_max_lifespan'] = array(
    '#type' => 'select',
    '#title' => t('Rendered output - Maximum lifetime'),
    '#description' => t('Rendered HTML output will be cached for <strong>at most</strong> this amount of time.'),
    '#options' => $options,
    '#default_value' => $this->options['output_max_lifespan'],
  );
}