You are here

function views_ajax_get_views_ajax_data_alter in Views Ajax Get 7

Implements hook_views_ajax_data_alter().

Adding the headers for cache control so that these requests can be cached.

File

./views_ajax_get.module, line 48
Allows Views ajax to work with GET instead of POST.

Code

function views_ajax_get_views_ajax_data_alter(&$commands, $view) {
  $exempt_views = variable_get('views_ajax_get_exemptions', array());

  // If view is excluded from conversion, don't add cache headers.
  if (drupal_page_is_cacheable() && (!isset($exempt_views[$view->name]) || !$exempt_views[$view->name])) {
    drupal_add_http_header('Cache-Control', 'public, max-age=' . variable_get('page_cache_maximum_age', 0));
  }
}