You are here

function authcache_debug_page_build in Authenticated User Page Caching (Authcache) 7.2

Implements hook_page_build().

Attach authcache JavaScript if page is going to be cached.

File

modules/authcache_debug/authcache_debug.module, line 68
Debug widget for Authcache.

Code

function authcache_debug_page_build(&$page) {

  // Add JS for debug mode?
  drupal_add_js(drupal_get_path('module', 'authcache_debug') . '/authcache_debug.js');
  drupal_add_css(drupal_get_path('module', 'authcache_debug') . '/authcache_debug.css');
  $callback = url('authcache-debug/ajax/' . _authcache_debug_cid());
  drupal_add_js(array(
    'authcacheDebug' => array(
      'url' => $callback,
      'all' => variable_get('authcache_debug_all', FALSE),
    ),
  ), 'setting');
  if (authcache_page_is_cacheable()) {

    // Status messages prevent pages from being cached.
    if (variable_get('authcache_debug_page', FALSE)) {
      drupal_set_message(t('Caching disabled by') . ' ' . l(t('Authcache Config.'), 'admin/config/system/authcache/debug'));
    }
  }
}