Skip to content

Commit

Permalink
Merge pull request civicrm#19629 from MegaphoneJon/core-2386
Browse files Browse the repository at this point in the history
core#2386 - metadata-driven chain-select fields
  • Loading branch information
eileenmcnaughton authored Mar 1, 2021
2 parents d63bd38 + 0512a83 commit 0843757
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 2 additions & 3 deletions CRM/Admin/Form/SettingTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,7 @@ protected function addFieldsDefinedInSettingsMetadata() {
);
}
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'));
Expand Down Expand Up @@ -288,6 +286,7 @@ protected function getQuickFormType($spec) {
'text' => 'Element',
'entity_reference' => 'EntityRef',
'advmultiselect' => 'Element',
'chainselect' => 'ChainSelect',
];
$mapping += array_fill_keys(CRM_Core_Form::$html5Types, '');
return $mapping[$htmlType] ?? '';
Expand Down
3 changes: 3 additions & 0 deletions settings/Localization.setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@
'type' => 'Integer',
'quick_form_type' => 'ChainSelect',
'html_type' => 'ChainSelect',
'chain_select_settings' => [
'control_field' => 'defaultContactCountry',
],
//'pseudoconstant' => array(
// 'callback' => 'CRM_Core_PseudoConstant::stateProvince',
//),
Expand Down

0 comments on commit 0843757

Please sign in to comment.