Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Drupal.org issue queue
Drupal.org issue queue
Security & Compliance
Security & Compliance
Dependency List
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
project
drupal
Commits
b4b6e9f0
Commit
b4b6e9f0
authored
May 13, 2013
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#1992052
by tim.plunkett: Allow machine_name() 'exists' to accept a callable.
parent
9b6caf53
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
core/includes/form.inc
core/includes/form.inc
+3
-3
No files found.
core/includes/form.inc
View file @
b4b6e9f0
...
...
@@ -3733,8 +3733,8 @@ function form_validate_table($element, &$form_state) {
* @param $element
* The form element to process. Properties used:
* - #machine_name: An associative array containing:
* - exists: A
function name to invoke for checking whether a submitted
*
machine name value already exists. The submitted value is passed as
* - exists: A
callable to invoke for checking whether a submitted machine
*
name value already exists. The submitted value is passed as an
* argument. In most cases, an existing API or menu argument loader
* function can be re-used. The callback is only invoked, if the submitted
* value differs from the element's #default_value.
...
...
@@ -3870,7 +3870,7 @@ function form_validate_machine_name(&$element, &$form_state) {
// Verify that the machine name is unique.
if
(
$element
[
'#default_value'
]
!==
$element
[
'#value'
])
{
$function
=
$element
[
'#machine_name'
][
'exists'
];
if
(
$function
(
$element
[
'#value'
],
$element
,
$form_state
))
{
if
(
call_user_func
(
$function
,
$element
[
'#value'
],
$element
,
$form_state
))
{
form_error
(
$element
,
t
(
'The machine-readable name is already in use. It must be unique.'
));
}
}
...
...
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