You are here

function authcache_form_requirements in Authenticated User Page Caching (Authcache) 7.2

Implements hook_requirements().

File

modules/authcache_form/authcache_form.install, line 10
Install, update and uninstall functions for the authcache form module.

Code

function authcache_form_requirements($phase) {
  $requirements = array();

  // Ensure translations don't break during installation.
  $t = get_t();

  // Check for Cache Object API.
  if (module_exists('cacheobject')) {
    $requirements['authcache_form'] = array(
      'title' => $t('Authcache Form'),
    );
    $form_cache_class = get_class(_cache_get_object('cache_form'));
    if ($form_cache_class === 'CacheObjectAPIWrapper') {
      $requirements['authcache_form']['value'] = $t('Using Cache Object API to extend validity of cached Ajax forms');
    }
    else {
      $requirements['authcache_form']['value'] = $t('Cache Object API is available but the form_cache bin is not configured to use it.');
      $requirements['authcache_form']['description'] = $t('Your settings.php file must be modified to allow Ajax forms to work properly. See <a href="@url">README.txt</a>.', array(
        '@url' => base_path() . drupal_get_path('module', 'authcache_form') . '/README.txt',
      ));
      $requirements['authcache_form']['severity'] = REQUIREMENT_WARNING;
    }
  }
  return $requirements;
}