Skip to content

Commit bd22b11

Browse files
Add new radio-group setting option
1 parent 834a183 commit bd22b11

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

assets/components/clientconfig/js/mgr/sections/home.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,32 @@ Ext.extend(ClientConfig.page.Home,MODx.Component,{
130130
field.checked = (value.value);
131131
}
132132

133+
if ((field.xtype === 'radiogroup') || (field.xtype === 'xradiogroup')) {
134+
field.xtype = 'radiogroup';
135+
field.columns = 4;
136+
field.items = [];
137+
138+
var options = value.options.split('||');
139+
Ext.each(options, function(option) {
140+
option = option.split('==');
141+
if (option[1]) {
142+
field.items.push({
143+
boxLabel: option[0],
144+
inputValue: option[1],
145+
checked: option[1] === field.value ? true : false,
146+
name: field.name
147+
})
148+
} else {
149+
field.items.push({
150+
boxLabel: option[0],
151+
inputValue: option[0],
152+
checked: option[0] === field.value ? true : false,
153+
name: field.name
154+
})
155+
}
156+
});
157+
}
158+
133159
if (field.xtype === 'datefield') {
134160
field.format = MODx.config.manager_date_format;
135161
}

assets/components/clientconfig/js/mgr/widgets/window.settings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ ClientConfig.window.Setting = function(config) {
7171
anchor: '100%',
7272
listeners: {
7373
select: {fn: function(field, record) {
74-
if (record.data.xtype === 'modx-combo') {
74+
if (['modx-combo', 'radiogroup', 'xradiogroup'].indexOf(record.data.xtype) !== -1) {
7575
Ext.getCmp(config.id + '-options').show();
7676
Ext.getCmp(config.id + '-process_options').show();
7777
} else {
@@ -97,7 +97,7 @@ ClientConfig.window.Setting = function(config) {
9797
fieldLabel: _('clientconfig.options'),
9898
description: _('clientconfig.options.desc'),
9999
anchor: '100%',
100-
hidden: (config.record && (config.record.xtype === 'modx-combo')) ? false : true
100+
hidden: (config.record && (['modx-combo', 'radiogroup', 'xradiogroup'].indexOf(config.record.xtype) !== -1)) ? false : true
101101
},{
102102
xtype: 'checkbox',
103103
id: config.id + '-process_options',

core/components/clientconfig/controllers/home.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function process(array $scriptProperties = []) {
4242
$googleFontsApiKey = $this->modx->getOption('clientconfig.google_fonts_api_key', null, '');
4343
$sa['xtype'] = empty($googleFontsApiKey) ? 'textfield' : $sa['xtype'];
4444
}
45-
elseif ($sa['xtype'] === 'modx-combo' && $setting->get('process_options')) {
45+
elseif ($setting->get('process_options') && in_array($sa['xtype'], ['modx-combo', 'radiogroup', 'xradiogroup'], true)) {
4646
$inputOpts = $setting->get('options');
4747
$this->modx->getParser();
4848
$this->modx->parser->processElementTags('', $inputOpts, true, true);

core/components/clientconfig/lexicon/en/default.inc.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,6 @@
113113
$_lang['clientconfig.xtype.line'] = 'Line (divider)';
114114
$_lang['clientconfig.xtype.code'] = 'Code (requires Ace editor installed)';
115115
$_lang['clientconfig.xtype.email'] = 'Email';
116+
117+
// New 2023-02-26
118+
$_lang['clientconfig.xtype.radiogroup'] = 'Radio Group';

0 commit comments

Comments
 (0)