summaryrefslogtreecommitdiff
path: root/includes/form.inc
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-09-10 07:58:40 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-09-10 07:58:40 +0000
commite4aab2d289ee97b563c9399b0b0580eaad4beda4 (patch)
tree396dbb76aeae2864b3988fdbb09420a867c01df7 /includes/form.inc
parent14c7a79e3f26da9690068ff0c72aaa6f40ce793a (diff)
downloadbrdo-e4aab2d289ee97b563c9399b0b0580eaad4beda4.tar.gz
brdo-e4aab2d289ee97b563c9399b0b0580eaad4beda4.tar.bz2
#763376 follow-up by fago, sun, effulgentsia: Minor adjustments to drupal_array_set/get_nested_value().
Diffstat (limited to 'includes/form.inc')
-rw-r--r--includes/form.inc23
1 files changed, 8 insertions, 15 deletions
diff --git a/includes/form.inc b/includes/form.inc
index f7ce97393..50e775199 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -1003,8 +1003,11 @@ function drupal_validate_form($form_id, &$form, &$form_state) {
if (isset($form_state['triggering_element']['#limit_validation_errors']) && $form_state['triggering_element']['#limit_validation_errors'] !== FALSE) {
$values = array();
foreach ($form_state['triggering_element']['#limit_validation_errors'] as $section) {
- list($value, $value_exists) = drupal_array_get_nested_value($form_state['values'], $section);
- if ($value_exists) {
+ // If the section exists within $form_state['values'], even if the value
+ // is NULL, copy it to $values.
+ $section_exists = NULL;
+ $value = drupal_array_get_nested_value($form_state['values'], $section, $section_exists);
+ if ($section_exists) {
drupal_array_set_nested_value($values, $section, $value);
}
}
@@ -1767,18 +1770,8 @@ function _form_builder_handle_input_element($form_id, &$element, &$form_state) {
if ($process_input) {
// Get the input for the current element. NULL values in the input need to
// be explicitly distinguished from missing input. (see below)
- $input = $form_state['input'];
- $input_exists = TRUE;
- foreach ($element['#parents'] as $parent) {
- if (is_array($input) && array_key_exists($parent, $input)) {
- $input = $input[$parent];
- }
- else {
- $input = NULL;
- $input_exists = FALSE;
- break;
- }
- }
+ $input_exists = NULL;
+ $input = drupal_array_get_nested_value($form_state['input'], $element['#parents'], $input_exists);
// For browser-submitted forms, the submitted values do not contain values
// for certain elements (empty multiple select, unchecked checkbox).
// During initial form processing, we add explicit NULL values for such
@@ -1850,7 +1843,7 @@ function _form_builder_handle_input_element($form_id, &$element, &$form_state) {
// Set the element's value in $form_state['values'], but only, if its key
// does not exist yet (a #value_callback may have already populated it).
- if (!drupal_array_nested_value_exists($form_state['values'], $element['#parents'])) {
+ if (!drupal_array_nested_key_exists($form_state['values'], $element['#parents'])) {
form_set_value($element, $element['#value'], $form_state);
}
}