You are here

function panels_content_cache_settings_form in Panels Content Cache 6

Same name and namespace in other branches
  1. 7 plugins/cache/content.inc \panels_content_cache_settings_form()
1 string reference to 'panels_content_cache_settings_form'
content.inc in plugins/cache/content.inc
Provides a content-based caching option for panel panes.

File

plugins/cache/content.inc, line 120
Provides a content-based caching option for panel panes.

Code

function panels_content_cache_settings_form($conf, $display, $pid) {
  $options = array_merge(array(
    'none' => 'none',
  ), drupal_map_assoc(array(
    15,
    30,
    60,
    120,
    180,
    240,
    300,
    600,
    900,
    1200,
    1800,
    3600,
    7200,
    14400,
    28800,
    43200,
    86400,
    172800,
    259200,
    345600,
    604800,
  ), 'format_interval'));
  $form['lifetime'] = array(
    '#title' => t('Lifetime'),
    '#type' => 'select',
    '#options' => $options,
    '#default_value' => $conf['lifetime'],
    '#description' => t('The cache lifetime is the minimum amount of time that will elapse before the cache is emptied and recreated. If set to none the
    cache will not be recreated unless a content update triggers a rebuild.'),
  );
  $form['cache_post'] = array(
    '#title' => t('Cache on POST requests'),
    '#description' => t('By default displays / panes are only cacheable on GET requests. Enabling this means the panel content will also be cached on a POST request. Be careful with this setting if you have content that is expected to change on a POST.'),
    '#type' => 'checkbox',
    '#default_value' => $conf['cache_post'],
  );
  $result = db_query("SELECT menu_name, title FROM {menu_custom} ORDER BY title");
  $menus = array();
  while ($menu = db_fetch_object($result)) {
    $menus[$menu->menu_name] = $menu->title;
  }
  $form['menus'] = array(
    '#title' => t('Menus'),
    '#description' => t('Checks changed menu configuration (re-ordering) or menu link changes (create / update) in the specified menu.'),
    '#type' => 'checkboxes',
    '#options' => $menus,
    '#default_value' => $conf['menus'],
  );
  $form['content_types'] = array(
    '#title' => t('Node types'),
    '#description' => t('Checks for new or updated nodes of any of the selected types.'),
    '#type' => 'checkboxes',
    '#options' => node_get_types('names'),
    '#default_value' => $conf['content_types'],
  );
  $form['granularity'] = array(
    '#title' => t('Granularity'),
    '#type' => 'select',
    '#options' => array(
      'args' => t('Arguments'),
      'context' => t('Context'),
      'none' => t('None'),
    ),
    '#description' => t('If "arguments" are selected, this content will be cached per individual argument to the entire display; if "contexts" are selected, this content will be cached per unique context in the pane or display; if "neither" there will be only one cache for this pane.'),
    '#default_value' => $conf['granularity'],
  );
  return $form;
}