user_build_content
function user_build_content
user_build_content($account, $view_mode = 'full', $langcode = NULL)
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.
File
- modules/user/user.module, line 2687
- 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. $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 view mode is stored if no module has already // populated the related key. $account->content += array('#view_mode' => $view_mode); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!user!user.module/function/user_build_content/7.x