fix: [settings:fields] Added support of textarea and fixed variant from severity
parent
a82c8fe62b
commit
64646aa118
|
@ -1,8 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
if ($setting['type'] == 'string' || empty($setting['type'])) {
|
if ($setting['type'] == 'string' || $setting['type'] == 'textarea' || empty($setting['type'])) {
|
||||||
$input = (function ($settingName, $setting, $appView) {
|
$input = (function ($settingName, $setting, $appView) {
|
||||||
$settingId = str_replace('.', '_', $settingName);
|
$settingId = str_replace('.', '_', $settingName);
|
||||||
return $appView->Bootstrap->genNode('input', [
|
return $appView->Bootstrap->genNode(
|
||||||
|
$setting['type'] == 'textarea' ? 'textarea' : 'input',
|
||||||
|
[
|
||||||
'class' => [
|
'class' => [
|
||||||
'form-control',
|
'form-control',
|
||||||
'pr-4',
|
'pr-4',
|
||||||
|
@ -10,13 +12,14 @@
|
||||||
(!empty($setting['error']) ? "border-{$appView->get('variantFromSeverity')[$setting['severity']]}" : ''),
|
(!empty($setting['error']) ? "border-{$appView->get('variantFromSeverity')[$setting['severity']]}" : ''),
|
||||||
(!empty($setting['error']) ? $appView->get('variantFromSeverity')[$setting['severity']] : ''),
|
(!empty($setting['error']) ? $appView->get('variantFromSeverity')[$setting['severity']] : ''),
|
||||||
],
|
],
|
||||||
'type' => 'text',
|
($setting['type'] == 'textarea' ? '' : 'type') => ($setting['type'] == 'textarea' ? '' : 'text'),
|
||||||
'id' => $settingId,
|
'id' => $settingId,
|
||||||
'data-setting-name' => $settingName,
|
'data-setting-name' => $settingName,
|
||||||
'value' => isset($setting['value']) ? $setting['value'] : "",
|
'value' => isset($setting['value']) ? $setting['value'] : "",
|
||||||
'placeholder' => $setting['default'] ?? '',
|
'placeholder' => $setting['default'] ?? '',
|
||||||
'aria-describedby' => "{$settingId}Help"
|
'aria-describedby' => "{$settingId}Help"
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
})($settingName, $setting, $this);
|
})($settingName, $setting, $this);
|
||||||
|
|
||||||
} elseif ($setting['type'] == 'boolean') {
|
} elseif ($setting['type'] == 'boolean') {
|
||||||
|
@ -26,7 +29,7 @@
|
||||||
'class' => [
|
'class' => [
|
||||||
'custom-control-input',
|
'custom-control-input',
|
||||||
(!empty($setting['error']) ? 'is-invalid' : ''),
|
(!empty($setting['error']) ? 'is-invalid' : ''),
|
||||||
(!empty($setting['error']) && $setting['severity'] == 'warning' ? 'warning' : ''),
|
(!empty($setting['error']) ? $appView->get('variantFromSeverity')[$setting['severity']] : ''),
|
||||||
],
|
],
|
||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'value' => !empty($setting['value']) ? 1 : 0,
|
'value' => !empty($setting['value']) ? 1 : 0,
|
||||||
|
|
Loading…
Reference in New Issue