summaryrefslogtreecommitdiff
path: root/modules/user/user.module
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-11-07 13:35:21 +0000
committerDries Buytaert <dries@buytaert.net>2009-11-07 13:35:21 +0000
commita8ec4e1d505c705ed891212cbf9149c71e4e0a31 (patch)
tree9784ad6ba7f1777614cc5de9221833f3072f9d94 /modules/user/user.module
parent803bd4f968f2d2e16c379cb915bc4fd75088bb6d (diff)
downloadbrdo-a8ec4e1d505c705ed891212cbf9149c71e4e0a31.tar.gz
brdo-a8ec4e1d505c705ed891212cbf9149c71e4e0a31.tar.bz2
- Patch #607244 by sun: added permission to decrease performance impact of contextual links.
Diffstat (limited to 'modules/user/user.module')
-rw-r--r--modules/user/user.module24
1 files changed, 15 insertions, 9 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index d8a60d8d3..488573709 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -2084,13 +2084,15 @@ function _user_cancel($edit, $account, $method) {
*
* @param $account
* A user object.
+ * @param $build_mode
+ * Build mode, e.g. 'full'.
*
* @return
* An array as expected by drupal_render().
*/
-function user_build($account) {
+function user_build($account, $build_mode = 'full') {
// Retrieve all profile fields and attach to $account->content.
- user_build_content($account);
+ user_build_content($account, $build_mode);
$build = $account->content;
// We don't need duplicate rendering info in account->content.
@@ -2099,8 +2101,12 @@ function user_build($account) {
$build += array(
'#theme' => 'user_profile',
'#account' => $account,
+ '#build_mode' => $build_mode,
);
+ // Allow modules to modify the structured user.
+ drupal_alter('user_build', $build);
+
return $build;
}
@@ -2109,19 +2115,19 @@ function user_build($account) {
*
* @param $account
* A user object.
- *
+ * @param $build_mode
+ * Build mode, e.g. 'full'.
*/
-function user_build_content($account) {
+function user_build_content($account, $build_mode = 'full') {
+ // Remove previously built content, if exists.
$account->content = array();
- $accounts = array($account->uid, $account);
- field_attach_prepare_view('user', $accounts, 'full');
-
// Build fields content.
- $account->content += field_attach_view('user', $account);
+ field_attach_prepare_view('user', array($account->uid, $account), $build_mode);
+ $account->content += field_attach_view('user', $account, $build_mode);
// Populate $account->content with a render() array.
- module_invoke_all('user_view', $account);
+ module_invoke_all('user_view', $account, $build_mode);
}
/**