From d24ea5ec97ff559406c7f8f49f13e1e0332b9a75 Mon Sep 17 00:00:00 2001 From: Zauberfisch Date: Sat, 1 Sep 2012 14:38:34 +0000 Subject: [PATCH] BUG jQueryUI configs broken because keys were all lowercase --- forms/DateField.php | 6 ++++-- javascript/DateField.js | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/forms/DateField.php b/forms/DateField.php index 6bac39a34..1f076d0e5 100644 --- a/forms/DateField.php +++ b/forms/DateField.php @@ -133,10 +133,12 @@ class DateField extends TextField { // Add other jQuery UI specific, namespaced options (only serializable, no callbacks etc.) // TODO Move to DateField_View_jQuery once we have a properly extensible HTML5 attribute system for FormField + $jqueryUIConfig = array(); foreach($this->getConfig() as $k => $v) { - if(preg_match('/^jQueryUI\.(.*)/', $k, $matches)) $config[$matches[1]] = $v; + if(preg_match('/^jQueryUI\.(.*)/', $k, $matches)) $jqueryUIConfig[$matches[1]] = $v; } - + if ($jqueryUIConfig) + $config['jqueryuiconfig'] = Convert::array2json(array_filter($jqueryUIConfig)); $config = array_filter($config); foreach($config as $k => $v) $this->setAttribute('data-' . $k, $v); diff --git a/javascript/DateField.js b/javascript/DateField.js index cd37db4a5..f3eb48341 100644 --- a/javascript/DateField.js +++ b/javascript/DateField.js @@ -8,7 +8,7 @@ $(this).siblings("button").addClass("ui-icon ui-icon-calendar"); var holder = $(this).parents('.field.date:first'), - config = $.extend(opts || {}, $(this).data(), {}); + config = $.extend(opts || {}, $(this).data(), $(this).data('jqueryuiconfig'), {}); if(!config.showcalendar) return; if(config.locale && $.datepicker.regional[config.locale]) {