summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2008-11-23 21:17:48 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2008-11-23 21:17:48 +0000
commit251a761eaa58b6f5e1eac7ff02a5d879e22eaa77 (patch)
treeccf1ccd340b33e910046a50343f6b8ca0b098e50 /includes
parent079a1bd2a5cf2d5429e64ed466dd51650b4ef5ba (diff)
downloadbrdo-251a761eaa58b6f5e1eac7ff02a5d879e22eaa77.tar.gz
brdo-251a761eaa58b6f5e1eac7ff02a5d879e22eaa77.tar.bz2
#337820 by Dave Reid: Rename menu path 'logout' to 'user/logout' for consistency.
Diffstat (limited to 'includes')
-rw-r--r--includes/form.inc18
1 files changed, 13 insertions, 5 deletions
diff --git a/includes/form.inc b/includes/form.inc
index e18262262..304793007 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -851,7 +851,7 @@ function form_error(&$element, $message = '') {
* $_POST data.
*/
function form_builder($form_id, $form, &$form_state) {
- static $complete_form, $cache, $file;
+ static $complete_form, $cache, $enctype;
// Initialize as unprocessed.
$form['#processed'] = FALSE;
@@ -864,6 +864,7 @@ function form_builder($form_id, $form, &$form_state) {
if (isset($form['#type']) && $form['#type'] == 'form') {
$cache = NULL;
+ $enctype = NULL;
$complete_form = $form;
if (!empty($form['#programmed'])) {
$form_state['submitted'] = TRUE;
@@ -937,6 +938,12 @@ function form_builder($form_id, $form, &$form_state) {
unset($form_state['buttons']);
}
+ // If an element requires to set the forms content type enctype attribute, we
+ // need to store this info in a static $enctype flag to update the parent
+ // form element. E.g. For files, non-ASCII data, and binary data.
+ if (isset($form['#enctype'])) {
+ $enctype = $form['#enctype'];
+ }
// If some callback set #cache, we need to flip a static flag so later it
// can be found.
if (!empty($form['#cache'])) {
@@ -948,14 +955,15 @@ function form_builder($form_id, $form, &$form_state) {
$file = TRUE;
}
if (isset($form['#type']) && $form['#type'] == 'form') {
+ // Set the form encoding if required.
+ if (isset($enctype)) {
+ $form['#attributes']['enctype'] = $enctype;
+ }
+
// We are on the top form, we can copy back #cache if it's set.
if (isset($cache)) {
$form['#cache'] = TRUE;
}
- // If there is a file element, we set the form encoding.
- if (isset($file)) {
- $form['#attributes']['enctype'] = 'multipart/form-data';
- }
}
return $form;
}