You are here

class AuthcacheFormTokenFragment in Authenticated User Page Caching (Authcache) 7.2

Retrieve CSRF-form token for the logged in user.

Hierarchy

Expanded class hierarchy of AuthcacheFormTokenFragment

See also

form.inc

2 string references to 'AuthcacheFormTokenFragment'
authcache_form_authcache_p13n_fragment in modules/authcache_form/authcache_form.module
Implements hook_authcache_p13n_fragment().
hook_authcache_p13n_fragment in modules/authcache_p13n/authcache_p13n.api.php
Declare markup fragments which contain personalized information.

File

modules/authcache_form/includes/AuthcacheFormTokenFragment.inc, line 12
Personalized fragment for CSRF tokens.

View source
class AuthcacheFormTokenFragment implements AuthcacheP13nFragmentInterface {

  /**
   * Render hidden field for CSRF token.
   */
  public function render($form_token_id, $ignored, $context) {
    include_once DRUPAL_ROOT . '/includes/common.inc';
    $form_token = drupal_get_token($form_token_id);
    return format_string('<input type="hidden" name="form_token" value="@form_token"></input>', array(
      '@form_token' => $form_token,
    ));
  }

}

Members