You are here

function authcache_form_cacheobject_load in Authenticated User Page Caching (Authcache) 7.2

Implements hook_cacheobject_load().

File

modules/authcache_form/authcache_form.module, line 45
Form token retrieval for Authcache.

Code

function authcache_form_cacheobject_load($objects, $cids, $bin) {
  if ($bin === 'cache_form') {
    foreach ($objects as $object) {

      // Restore the token if this entry has been cloned from an immutable form
      // cache entry (see authcache_form_form_alter).
      if (!empty($object->data['#authcache_immutable'])) {
        unset($object->data['#authcache_immutable']);
        $object->data['#cache_token'] = drupal_get_token();
      }
      elseif (isset($object->data['#cache_token_authcache_key'])) {

        // Compatibility layer for cache entries created with previous authcache
        // versions.
        if ($object->data['#cache_token_authcache_key'] === authcache_key()) {
          $object->data['#cache_token'] = drupal_get_token();
        }
      }
    }
  }
}