function ctools_user_profile_content_type_render
Render the user profile content type.
File
-
plugins/
content_types/ user_context/ user_profile.inc, line 24
Code
function ctools_user_profile_content_type_render($subtype, $conf, $panel_args, $context) {
$account = isset($context->data) ? clone $context->data : NULL;
if (!$account) {
return NULL;
}
// Retrieve all profile fields and attach to $account->content.
if (!isset($account->content)) {
user_build_content($account, isset($conf['view_mode']) ? $conf['view_mode'] : 'full');
}
$build = $account->content;
// We don't need duplicate rendering info in account->content.
unset($account->content);
$build += array(
'#theme' => 'user_profile',
'#account' => $account,
// @todo support view mode
'#view_mode' => isset($conf['view_mode']) ? $conf['view_mode'] : 'full',
// @todo do we need to support this?
'#language' => NULL,
);
// Allow modules to modify the structured user.
$type = 'user';
drupal_alter(array(
'user_view',
'entity_view',
), $build, $type);
$block = new stdClass();
$block->module = 'user-profile';
$block->title = check_plain(format_username($account));
$block->content = $build;
return $block;
}