summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Haug2010-12-08 21:46:07 +0000
committerNathan Haug2010-12-08 21:46:07 +0000
commit2d3b6a20f8f00a295dd374a3081d5409eed39b1f (patch)
treeca3aa14020d97f0259596ad2c5e0b4c16af78f04
parent37c2bbc9e79944f79b21609de336bea87d58a06b (diff)
#985790: List of current extensions gets extra commas when validation fails.
-rw-r--r--filefield_widget.inc5
1 files changed, 3 insertions, 2 deletions
diff --git a/filefield_widget.inc b/filefield_widget.inc
index 139ccc0..d9de9cc 100644
--- a/filefield_widget.inc
+++ b/filefield_widget.inc
@@ -99,7 +99,7 @@ function filefield_widget_settings_save($widget) {
* A FAPI #pre_render() function to set a cosmetic default value for extensions.
*/
function _filefield_widget_settings_extensions_value($element) {
- $element['#value'] = implode(', ', explode(' ', $element['#value']));
+ $element['#value'] = implode(', ', array_filter(explode(' ', str_replace(',', ' ', $element['#value']))));
return $element;
}
@@ -107,8 +107,9 @@ function _filefield_widget_settings_extensions_value($element) {
* A FAPI #element_validate callback to strip commas from extension lists.
*/
function _filefield_widget_settings_extensions_validate($element, &$form_state) {
- // Remove commas from file extensions.
+ // Remove commas and leading dots from file extensions.
$value = str_replace(',', ' ', $element['#value']);
+ $value = str_replace(' .', ' ', $value);
$value = array_filter(explode(' ', $value));
$value = implode(' ', $value);
form_set_value($element, $value, $form_state);