function user_build_content

7.x user.module user_build_content($account, $view_mode = 'full', $langcode = NULL)
6.x user.module user_build_content(&$account)

Builds a structured array representing the profile content.

Parameters

$account: A user object.

$view_mode: View mode, e.g. 'full'.

$langcode: (optional) A language code to use for rendering. Defaults to the global content language of the current request.

1 call to user_build_content()
user_view in drupal-7.x/modules/user/user.module
Generate an array for rendering the given user.

File

drupal-7.x/modules/user/user.module, line 2627
Enables the user registration and login system.

Code

function user_build_content($account, $view_mode = 'full', $langcode = NULL) {
  if (!isset($langcode)) {
    $langcode = $GLOBALS['language_content']->language;
  }

  // Remove previously built content, if exists.
  $account->content = array();

  // Allow modules to change the view mode.
  $context = array(
    'entity_type' => 'user',
    'entity' => $account,
    'langcode' => $langcode,
  );
  drupal_alter('entity_view_mode', $view_mode, $context);

  // 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 view mode is stored if no module has already
  // populated the related key.
  $account->content += array('#view_mode' => $view_mode);
}