Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
225
Merge Requests
225
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
d3ed6724
Commit
d3ed6724
authored
Jun 08, 2011
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1149188
by fago: Fixed machine_name.js does not respect maxlength of target field.
parent
82419788
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
misc/machine-name.js
misc/machine-name.js
+4
-1
No files found.
misc/machine-name.js
View file @
d3ed6724
...
...
@@ -35,6 +35,8 @@ Drupal.behaviors.machineName = {
if
(
$target
.
hasClass
(
'
error
'
))
{
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.
$wrapper
.
hide
();
// Determine the initial machine name value. Unless the machine name form
...
...
@@ -103,13 +105,14 @@ Drupal.behaviors.machineName = {
* disallowed characters in the machine name; e.g., '[^a-z0-9]+'.
* - replace: A character to replace disallowed characters with; e.g., '_'
* or '-'.
* - maxlength: The maximum length of the machine name.
*
* @return
* The transliterated source string.
*/
transliterate
:
function
(
source
,
settings
)
{
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
)
;
}
};
...
...
Write
Preview
Markdown
is supported
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