summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-11-15 13:01:11 +0000
committerDries Buytaert <dries@buytaert.net>2008-11-15 13:01:11 +0000
commit15671f471b5097fd20c5951a9c835de9bb05fc5b (patch)
treeb3b22b4f670da5c6880cadb593eae285bf623995 /includes
parent97fdc491917f6f12d734cb13bf2101cfc12096fd (diff)
downloadbrdo-15671f471b5097fd20c5951a9c835de9bb05fc5b.tar.gz
brdo-15671f471b5097fd20c5951a9c835de9bb05fc5b.tar.bz2
- Patch #332123 by webchick, lilou: remove t() function from schema descriptions.
Diffstat (limited to 'includes')
-rw-r--r--includes/form.inc19
1 files changed, 15 insertions, 4 deletions
diff --git a/includes/form.inc b/includes/form.inc
index 4512fb0ad..6da6440ba 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -852,7 +852,7 @@ function form_error(&$element, $message = '') {
* $_POST data.
*/
function form_builder($form_id, $form, &$form_state) {
- static $complete_form, $cache;
+ static $complete_form, $cache, $file;
// Initialize as unprocessed.
$form['#processed'] = FALSE;
@@ -943,9 +943,20 @@ function form_builder($form_id, $form, &$form_state) {
if (!empty($form['#cache'])) {
$cache = $form['#cache'];
}
- // We are on the top form, we can copy back #cache if it's set.
- if (isset($form['#type']) && $form['#type'] == 'form' && isset($cache)) {
- $form['#cache'] = TRUE;
+ // If there is a file element, we need to flip a static flag so later the
+ // form encoding can be set.
+ if ($form['#type'] == 'file') {
+ $file = TRUE;
+ }
+ if (isset($form['#type']) && $form['#type'] == 'form') {
+ // 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;
}