From 0512a83fe3b6358aa715bd677df75b3a998a082d Mon Sep 17 00:00:00 2001 From: Jon Goldberg Date: Thu, 18 Feb 2021 13:29:58 -0500 Subject: [PATCH] core#2386 - metadata-driven chain-select fields --- CRM/Admin/Form/SettingTrait.php | 5 ++--- settings/Localization.setting.php | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CRM/Admin/Form/SettingTrait.php b/CRM/Admin/Form/SettingTrait.php index 184caa7342..61b45298b3 100644 --- a/CRM/Admin/Form/SettingTrait.php +++ b/CRM/Admin/Form/SettingTrait.php @@ -213,9 +213,7 @@ trait CRM_Admin_Form_SettingTrait { ); } elseif ($add === 'addChainSelect') { - $this->addChainSelect($setting, [ - 'label' => $props['title'], - ]); + $this->addChainSelect($setting, ['label' => $props['title']] + $props['chain_select_settings']); } elseif ($add === 'addMonthDay') { $this->add('date', $setting, $props['title'], CRM_Core_SelectValues::date(NULL, 'M d')); @@ -288,6 +286,7 @@ trait CRM_Admin_Form_SettingTrait { 'text' => 'Element', 'entity_reference' => 'EntityRef', 'advmultiselect' => 'Element', + 'chainselect' => 'ChainSelect', ]; $mapping += array_fill_keys(CRM_Core_Form::$html5Types, ''); return $mapping[$htmlType] ?? ''; diff --git a/settings/Localization.setting.php b/settings/Localization.setting.php index 6854b52259..ec1be4f3bb 100644 --- a/settings/Localization.setting.php +++ b/settings/Localization.setting.php @@ -155,6 +155,9 @@ return [ 'type' => 'Integer', 'quick_form_type' => 'ChainSelect', 'html_type' => 'ChainSelect', + 'chain_select_settings' => [ + 'control_field' => 'defaultContactCountry', + ], //'pseudoconstant' => array( // 'callback' => 'CRM_Core_PseudoConstant::stateProvince', //), -- 2.25.1