You are here

function authcache_user_view_alter in Authenticated User Page Caching (Authcache) 7.2

Implements hook_user_view_alter().

See also

flag_user_view()

File

modules/authcache_flag/authcache_flag.module, line 83
Provide personalization for the flag module.

Code

function authcache_user_view_alter(&$build) {
  if (authcache_page_is_cacheable()) {
    $account = $build['#account'];
    list($id) = entity_extract_ids('user', $account);
    $flags = flag_get_flags('user');
    foreach ($flags as $flag) {

      // Substitute profile field.
      if (isset($build['flags'][$flag->name])) {
        authcache_p13n_attach($build['flags'][$flag->name], array(
          '#theme' => 'authcache_p13n_partial',
          '#assembly' => 'flags',
          '#partial' => _authcache_flag_partial_id($flag),
          '#param' => $id,
          '#fallback' => 'cancel',
        ));
      }
    }
  }
}