1 user.entity.inc | public UserStorageController::buildContent(EntityInterface $account, $view_mode = 'full', $langcode = NULL) |
Implements EntityControllerInterface::buildContent().
Overrides DefaultEntityController::buildContent
File
- core/
modules/ user/ user.entity.inc, line 518 - Entity classes and controllers for User module.
Class
- UserStorageController
- Controller class for users.
Code
public function buildContent(EntityInterface $account, $view_mode = 'full', $langcode = NULL) {
global $language_content;
$langcode = $langcode ? $langcode : $language_content->langcode;
// Remove previously built content, if exists.
$account->content = array();
// Allow modules to change the display mode.
$view_mode = key(entity_view_mode_prepare('user', array($account->uid => $account), $view_mode, $langcode));
// Build fields content.
field_attach_prepare_view('user', array($account->uid => $account), $view_mode, $langcode);
entity_prepare_view('user', array($account->uid => $account), $langcode);
$account->content += field_attach_view('user', $account, $view_mode, $langcode);
// Populate $account->content with a render() array.
module_invoke_all('user_view', $account, $view_mode, $langcode);
module_invoke_all('entity_view', $account, 'user', $view_mode, $langcode);
// Make sure the current display mode is stored if no module has already
// populated the related key.
$account->content += array('#view_mode' => $view_mode);
}