Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
d8c73958
Commit
d8c73958
authored
13 years ago
by
catch
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#1346760
by xjm, droplet, catch: Fixed Drag and drop needs a scalable weight select element.
parent
15ddbd88
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/includes/form.inc
+20
-6
20 additions, 6 deletions
core/includes/form.inc
core/modules/system/system.module
+7
-0
7 additions, 0 deletions
core/modules/system/system.module
with
27 additions
and
6 deletions
core/includes/form.inc
+
20
−
6
View file @
d8c73958
...
...
@@ -3792,13 +3792,27 @@ function theme_password($variables) {
* Expand weight elements into selects.
*/
function
form_process_weight
(
$element
)
{
for
(
$n
=
(
-
1
*
$element
[
'#delta'
]);
$n
<=
$element
[
'#delta'
];
$n
++
)
{
$weights
[
$n
]
=
$n
;
}
$element
[
'#options'
]
=
$weights
;
$element
[
'#type'
]
=
'select'
;
$element
[
'#is_weight'
]
=
TRUE
;
$element
+=
element_info
(
'select'
);
// If the number of options is small enough, use a select field.
$max_elements
=
variable_get
(
'drupal_weight_select_max'
,
DRUPAL_WEIGHT_SELECT_MAX
);
if
(
$element
[
'#delta'
]
<=
$max_elements
)
{
$element
[
'#type'
]
=
'select'
;
for
(
$n
=
(
-
1
*
$element
[
'#delta'
]);
$n
<=
$element
[
'#delta'
];
$n
++
)
{
$weights
[
$n
]
=
$n
;
}
$element
[
'#options'
]
=
$weights
;
$element
+=
element_info
(
'select'
);
}
// Otherwise, use a text field.
else
{
$element
[
'#type'
]
=
'textfield'
;
// Use a field big enough to fit most weights.
$element
[
'#size'
]
=
10
;
$element
[
'#element_validate'
]
=
array
(
'element_validate_integer'
);
$element
+=
element_info
(
'textfield'
);
}
return
$element
;
}
...
...
This diff is collapsed.
Click to expand it.
core/modules/system/system.module
+
7
−
0
View file @
d8c73958
...
...
@@ -45,6 +45,13 @@
*/
const
DRUPAL_REQUIRED
=
2
;
/**
* Maximum number of values in a weight select element.
*
* If the number of values is over the maximum, a text field is used instead.
*/
const
DRUPAL_WEIGHT_SELECT_MAX
=
100
;
/**
* Return only visible regions.
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment