You are here

function authcache_user_preprocess_toolbar in Authenticated User Page Caching (Authcache) 7.2

Implements hook_preprocess_toolbar().

File

modules/authcache_user/authcache_user.module, line 57
Provide profile data of logged in user as personalized setting.

Code

function authcache_user_preprocess_toolbar(&$variables) {
  if (isset($variables['toolbar']['toolbar_user']['#links']['account']) && !authcache_element_is_cacheable($variables['toolbar']['toolbar_user'])) {
    $replacement = array(
      '#theme' => 'html_tag',
      '#tag' => 'span',
    );
    authcache_user_attach_property($replacement, 'name');
    $variables['toolbar']['toolbar_user']['#links']['account']['title'] = t('Hello <strong>!username</strong>', array(
      '!username' => render($replacement),
    ));
    authcache_element_set_cacheable($variables['toolbar']['toolbar_user']);
  }
}