function masquerade_user_view in Masquerade 8.2
Same name and namespace in other branches
- 7 masquerade.module \masquerade_user_view()
Implements hook_ENTITY_TYPE_view().
File
- ./
masquerade.module, line 169 - Allows privileged users to masquerade as another user.
Code
function masquerade_user_view(array &$build, UserInterface $account, EntityViewDisplayInterface $display, $view_mode) {
if ($display
->getComponent('masquerade')) {
// Use post render to allow caching.
$build['masquerade'] = [
'#lazy_builder' => [
'masquerade.callbacks:renderCacheLink',
[
$account
->id(),
],
],
'#create_placeholder' => TRUE,
];
}
}