You are here

function _authcache_default_form_after_build in Authenticated User Page Caching (Authcache) 7.2

Form API default after-build callback for forms on cacheable pages.

Related topics

1 string reference to '_authcache_default_form_after_build'
authcache_form_alter in ./authcache.module
Implements hook_form_alter().

File

./authcache.module, line 360
Authenticated User Page Caching (and anonymous users, too!)

Code

function _authcache_default_form_after_build($form, $form_state) {
  global $user;
  if (authcache_page_is_cacheable()) {

    // Disable form cache and remove build_id if caching is not explicitely
    // requested.
    if (empty($form_state['rebuild']) && empty($form_state['cache'])) {
      $form_state['no_cache'] = TRUE;
      unset($form['form_build_id']);
      unset($form['#build_id']);

      // Enable caching of form value elements without further processing when
      // the form cache is not used.
      authcache_form_value_set_cacheable($form);
    }
  }
  return $form;
}