Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
clientside_validation
Commits
09f8f007
Commit
09f8f007
authored
Apr 10, 2012
by
Peter Droogmans
Browse files
Issue #1525360 by smilne23: Added Exclude specific fields based upon their DOM ID.
parent
02b6cec3
Changes
1
Hide whitespace changes
Inline
Side-by-side
clientside_validation_form/clientside_validation_form.module
View file @
09f8f007
...
...
@@ -25,7 +25,14 @@ function clientside_validation_form_after_build_recurse($form_id, &$form, &$form
function
clientside_validation_regular
(
$form_id
,
$element
,
&
$js_rules
,
$form_state
)
{
static
$multiples
=
array
();
if
(
isset
(
$element
[
'#name'
]))
{
$skipvalidation
=
FALSE
;
if
(
isset
(
$element
[
'#entity_type'
])
&&
isset
(
$element
[
'#field_name'
])
&&
isset
(
$element
[
'#bundle'
]))
{
$field_info
=
field_info_instance
(
$element
[
'#entity_type'
],
$element
[
'#field_name'
],
$element
[
'#bundle'
]);
if
(
isset
(
$field_info
[
'exclude_cv'
])
&&
$field_info
[
'exclude_cv'
]
==
'1'
)
{
$skipvalidation
=
TRUE
;
}
}
if
(
isset
(
$element
[
'#name'
])
&&
!
$skipvalidation
)
{
$el_name
=
$element
[
'#name'
];
$el_title
=
$el_name
;
if
(
isset
(
$element
[
'#title'
]))
{
...
...
@@ -137,3 +144,23 @@ function clientside_validation_regular($form_id, $element, &$js_rules, $form_sta
}
}
}
function
clientside_validation_form_field_info_alter
(
&
$info
)
{
// Add a setting to all field types.
foreach
(
$info
as
$field_type
=>
&
$field_type_info
)
{
$field_type_info
+=
array
(
'instance_settings'
=>
array
());
$field_type_info
[
'instance_settings'
]
+=
array
(
'exclude_cv'
=>
FALSE
,
);
}
}
function
clientside_validation_form_form_field_ui_field_edit_form_alter
(
&
$form
,
&
$form_state
,
$form_id
)
{
$form
[
'instance'
][
'exclude_cv'
]
=
array
(
'#type'
=>
'checkbox'
,
'#title'
=>
'Exclude from clientside validation'
,
'#description'
=>
'Check this option if you do not want to add clientside validation.'
,
'#default_value'
=>
isset
(
$form
[
'#instance'
][
'exclude_cv'
])
?
$form
[
'#instance'
][
'exclude_cv'
]
:
FALSE
,
'#weight'
=>
-
9
,
);
}
\ No newline at end of file
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