1 user.entity.inc public UserStorageController::view($accounts, $view_mode = 'full', $langcode = NULL, $page = NULL)

Overrides DefaultEntityController::view().

Overrides DefaultEntityController::view

File

core/modules/user/user.entity.inc, line 545
Entity classes and controllers for User module.

Class

UserStorageController
Controller class for users.

Code

public function view($accounts, $view_mode = 'full', $langcode = NULL, $page = NULL) {
  global $language_content;
  $langcode = $langcode ? $langcode : $language_content->langcode;

  $view = array();
  foreach ($accounts as $account) {
    /* @var User $account */
    // Retrieve all profile fields and attach to $account->content.
    $this->buildContent($account, $view_mode, $langcode);

    $build = $account->content;
    // We don't need duplicate rendering info in account->content.
    unset($account->content);

    $build += array(
      '#theme' => 'user_profile',
      '#account' => $account,
      '#view_mode' => $view_mode,
      '#language' => $langcode,
      '#page' => $page,
    );

    // Allow modules to modify the structured user.
    $type = 'user';
    backdrop_alter(array('user_view', 'entity_view'), $build, $type);
    $view[$type][$account->id()] = $build;
  }

  return $view;
}