You are here

function community_tags_authcache_form_community_tags_form_alter in Community Tags 6.2

Remove the personalised data in the form - i.e. my tags - these will be loaded via authcache ajax.

File

community_tags_authcache/community_tags_authcache.module, line 13

Code

function community_tags_authcache_form_community_tags_form_alter(&$form, &$form_state) {
  global $user, $is_page_authcache;
  if ($is_page_authcache) {
    if (_community_tags_tag_access()) {

      // unset user specific values in the CT form
      unset($form['tags']['#default_value']);
      unset($form['tags_refs']['#value']);

      // add ct-processed class to prevent CT adding behaviour until user's
      // tags are loaded via ajax.
      $form['tags']['#attributes']['class'] .= ' ct-processed';
      drupal_add_js(drupal_get_path('module', 'community_tags_authcache') . '/community_tags_authcache.js', 'module', 'header');
    }

    // maintain user role cache keys for clearing selected node pages from authcache page cache
    _community_tags_authcache_update_role_keys();
  }
}