From 5c33bd6b5ce55d73334be77c80c658abcdd6db07 Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 5 Nov 2018 13:45:48 +1300 Subject: [PATCH] Fix handling of advmutltiselect (on localization form) Add deprecation notice rather than hard-fail for incorrect case for html type. We have clarified the correct syntax (it was haphazard) an updated the docs. This ALSO fixes fails on localisation form --- CRM/Admin/Form/SettingTrait.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CRM/Admin/Form/SettingTrait.php b/CRM/Admin/Form/SettingTrait.php index 03aa91fc62..328cb214a2 100644 --- a/CRM/Admin/Form/SettingTrait.php +++ b/CRM/Admin/Form/SettingTrait.php @@ -219,8 +219,17 @@ trait CRM_Admin_Form_SettingTrait { protected function getQuickFormType($spec) { if (isset($spec['quick_form_type']) && !($spec['quick_form_type'] === 'Element' && !empty($spec['html_type']))) { + // This is kinda transitional return $spec['quick_form_type']; } + + // The spec for settings has been updated for consistency - we provide deprecation notices for sites that have + // not made this change. + $htmlType = $spec['html_type']; + if ($htmlType !== strtolower($htmlType)) { + CRM_Core_Error::deprecatedFunctionWarning(ts('Settings fields html_type should be lower case - see https://docs.civicrm.org/dev/en/latest/framework/setting/ - this needs to be fixed for ' . $spec['name'])); + $htmlType = strtolower($spec['html_type']); + } $mapping = [ 'checkboxes' => 'CheckBoxes', 'checkbox' => 'CheckBox', @@ -229,8 +238,9 @@ trait CRM_Admin_Form_SettingTrait { 'textarea' => 'Element', 'text' => 'Element', 'entity_reference' => 'EntityRef', + 'advmultiselect' => 'Element', ]; - return $mapping[$spec['html_type']]; + return $mapping[$htmlType]; } /** * Get the defaults for all fields defined in the metadata. -- 2.25.1