Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
13f98829
Commit
13f98829
authored
Oct 25, 2007
by
Gábor Hojtsy
Browse files
#179276
by JirkaRybka: (regression) fix profile field sections to order properly by weight.
parent
b036bef6
Changes
3
Hide whitespace changes
Inline
Side-by-side
includes/common.inc
View file @
13f98829
...
...
@@ -2612,7 +2612,7 @@ function drupal_render(&$elements) {
// Either the elements did not go through form_builder or one of the children
// has a #weight.
if
(
!
isset
(
$elements
[
'#sorted'
]))
{
uasort
(
$elements
,
"
_
element_sort"
);
uasort
(
$elements
,
"element_sort"
);
}
$elements
+=
array
(
'#title'
=>
NULL
,
'#description'
=>
NULL
);
if
(
!
isset
(
$elements
[
'#children'
]))
{
...
...
@@ -2676,9 +2676,9 @@ function drupal_render(&$elements) {
}
/**
* Function used by uasort
in drupal_render()
to sort structured arrays by weight.
* Function used by uasort to sort structured arrays by weight.
*/
function
_
element_sort
(
$a
,
$b
)
{
function
element_sort
(
$a
,
$b
)
{
$a_weight
=
(
is_array
(
$a
)
&&
isset
(
$a
[
'#weight'
]))
?
$a
[
'#weight'
]
:
0
;
$b_weight
=
(
is_array
(
$b
)
&&
isset
(
$b
[
'#weight'
]))
?
$b
[
'#weight'
]
:
0
;
if
(
$a_weight
==
$b_weight
)
{
...
...
modules/user/user.module
View file @
13f98829
...
...
@@ -569,7 +569,7 @@ function user_user($type, &$edit, &$account, $category = NULL) {
$account
->
content
[
'summary'
]
+=
array
(
'#type'
=>
'user_profile_category'
,
'#attributes'
=>
array
(
'class'
=>
'user-member'
),
'#weight'
=>
-
5
,
'#weight'
=>
5
,
'#title'
=>
t
(
'History'
),
);
$account
->
content
[
'summary'
][
'member_for'
]
=
array
(
...
...
modules/user/user.pages.inc
View file @
13f98829
...
...
@@ -170,6 +170,8 @@ function user_view($account) {
*/
function
template_preprocess_user_profile
(
&
$variables
)
{
$variables
[
'profile'
]
=
array
();
// Sort sections by weight
uasort
(
$variables
[
'account'
]
->
content
,
'element_sort'
);
// Provide keyed variables so themers can print each section independantly.
foreach
(
element_children
(
$variables
[
'account'
]
->
content
)
as
$key
)
{
$variables
[
'profile'
][
$key
]
=
drupal_render
(
$variables
[
'account'
]
->
content
[
$key
]);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment