You are here

function template_preprocess_authcache_p13n_fragment in Authenticated User Page Caching (Authcache) 7.2

Preprocess a placeholder for a personalized fragment.

Related topics

File

modules/authcache_p13n/authcache_p13n.module, line 171
Provides methods for serving personalized content fragments.

Code

function template_preprocess_authcache_p13n_fragment(&$variables) {
  $fragment = $variables['fragment'];
  $param = $variables['param'];
  $clients = $variables['clients'];
  $client = authcache_p13n_client_get_preferred('fragment', $fragment, $clients);
  if ($client && strlen($fragment)) {
    $url = authcache_p13n_request_get_callback('frag/' . $fragment, $param);
  }
  if (!empty($url)) {
    $variables['theme_hook_suggestions'][] = 'authcache_p13n_fragment__' . $client;
    $variables['theme_hook_suggestions'][] = 'authcache_p13n_fragment__' . $client . '__' . preg_replace('/_{2,}/', '_', preg_replace('/[^0-9a-z]/i', '_', $fragment));
    $variables['client'] = $client;
    $variables['url'] = $url;
  }
}