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
d3ed6724
Commit
d3ed6724
authored
13 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#1149188
by fago: Fixed machine_name.js does not respect maxlength of target field.
parent
82419788
No related branches found
No related tags found
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
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
misc/machine-name.js
+4
-1
4 additions, 1 deletion
misc/machine-name.js
with
4 additions
and
1 deletion
misc/machine-name.js
+
4
−
1
View file @
d3ed6724
...
@@ -35,6 +35,8 @@ Drupal.behaviors.machineName = {
...
@@ -35,6 +35,8 @@ Drupal.behaviors.machineName = {
if
(
$target
.
hasClass
(
'
error
'
))
{
if
(
$target
.
hasClass
(
'
error
'
))
{
return
;
return
;
}
}
// Figure out the maximum length for the machine name.
options
.
maxlength
=
$target
.
attr
(
'
maxlength
'
);
// Hide the form item container of the machine name form element.
// Hide the form item container of the machine name form element.
$wrapper
.
hide
();
$wrapper
.
hide
();
// Determine the initial machine name value. Unless the machine name form
// Determine the initial machine name value. Unless the machine name form
...
@@ -103,13 +105,14 @@ Drupal.behaviors.machineName = {
...
@@ -103,13 +105,14 @@ Drupal.behaviors.machineName = {
* disallowed characters in the machine name; e.g., '[^a-z0-9]+'.
* disallowed characters in the machine name; e.g., '[^a-z0-9]+'.
* - replace: A character to replace disallowed characters with; e.g., '_'
* - replace: A character to replace disallowed characters with; e.g., '_'
* or '-'.
* or '-'.
* - maxlength: The maximum length of the machine name.
*
*
* @return
* @return
* The transliterated source string.
* The transliterated source string.
*/
*/
transliterate
:
function
(
source
,
settings
)
{
transliterate
:
function
(
source
,
settings
)
{
var
rx
=
new
RegExp
(
settings
.
replace_pattern
,
'
g
'
);
var
rx
=
new
RegExp
(
settings
.
replace_pattern
,
'
g
'
);
return
source
.
toLowerCase
().
replace
(
rx
,
settings
.
replace
);
return
source
.
toLowerCase
().
replace
(
rx
,
settings
.
replace
)
.
substr
(
0
,
settings
.
maxlength
)
;
}
}
};
};
...
...
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