From 238fee7f60f6df3d83d659b50443d523f9c92476 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sun, 20 Dec 2015 17:53:15 -0500 Subject: [PATCH] CRM-16019 - Add crmDatepicker binding to CRM_Core_Form --- CRM/Core/Form.php | 5 +++++ js/Common.js | 3 +++ 2 files changed, 8 insertions(+) diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 8b128ae24a..57619a4ce1 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -331,6 +331,11 @@ class CRM_Core_Form extends HTML_QuickForm_Page { $attributes['class'] .= ' crm-form-wysiwyg'; $type = "textarea"; } + if ($type == 'datepicker') { + $attributes = ($attributes ? $attributes : array()) + array('class' => ''); + $attributes['data-crm-datepicker'] = json_encode((array) $extra); + $type = "text"; + } if ($type == 'select' && is_array($extra)) { // Normalize this property if (!empty($extra['multiple'])) { diff --git a/js/Common.js b/js/Common.js index fda5c0bfda..6a35778063 100644 --- a/js/Common.js +++ b/js/Common.js @@ -925,6 +925,9 @@ if (!CRM.vars) CRM.vars = {}; $('.crm-select2:not(.select2-offscreen, .select2-container)', e.target).crmSelect2(); $('.crm-form-entityref:not(.select2-offscreen, .select2-container)', e.target).crmEntityRef(); $('select.crm-chain-select-control', e.target).off('.chainSelect').on('change.chainSelect', chainSelect); + $('.crm-form-text[data-crm-datepicker]', e.target).each(function() { + $(this).crmDatepicker($(this).data('crmDatepicker')); + }); // Cache Form Input initial values $('form[data-warn-changes] :input', e.target).each(function() { $(this).data('crm-initial-value', $(this).is(':checkbox, :radio') ? $(this).prop('checked') : $(this).val()); -- 2.25.1