You are here

function theme_authcache_p13n_assembly__authcache_esi in Authenticated User Page Caching (Authcache) 7.2

Theme function for groups of fragments loaded in only one ESI include.

File

modules/authcache_esi/authcache_esi.module, line 82
Authcache ESI markup generator.

Code

function theme_authcache_p13n_assembly__authcache_esi($variables) {
  $url = $variables['url'];
  $class = $variables['class'];
  if ($url && $class) {
    drupal_add_http_header('X-Authcache-Do-ESI', 1);
    drupal_add_js(drupal_get_path('module', 'authcache_p13n') . '/authcache_p13n.js');
    drupal_add_js(drupal_get_path('module', 'authcache_esi') . '/authcache_esi.js');
    $iframe_attrs = array(
      'src' => 'about:blank',
      'class' => array(
        'authcache-esi-assembly',
      ),
      'data-authcache-esi-target' => 'span.' . $class,
    );
    $esi_attrs = array(
      'src' => url($url['path'], $url['options']),
    );
    return '<iframe ' . drupal_attributes($iframe_attrs) . '><esi:include ' . drupal_attributes($esi_attrs) . '/></iframe>';
  }
}