new: [generic form] added checkbox option for boolean fields in metatemplates

cli-modification-summary
iglocska 2022-11-09 14:00:18 +01:00
parent 16a3826cef
commit d43e7c6c22
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
2 changed files with 9 additions and 0 deletions

View File

@ -112,6 +112,7 @@
echo $this->Bootstrap->modal([ echo $this->Bootstrap->modal([
'title' => empty($data['title']) ? sprintf('%s %s', $actionName, $modelName) : h($data['title']), 'title' => empty($data['title']) ? sprintf('%s %s', $actionName, $modelName) : h($data['title']),
'bodyHtml' => $this->element('genericElements/Form/formLayouts/formRaw', [ 'bodyHtml' => $this->element('genericElements/Form/formLayouts/formRaw', [
'data' => $data,
'formCreate' => $formCreate, 'formCreate' => $formCreate,
'ajaxFlashMessage' => $ajaxFlashMessage, 'ajaxFlashMessage' => $ajaxFlashMessage,
'fieldsString' => $fieldsString, 'fieldsString' => $fieldsString,
@ -124,6 +125,7 @@
]); ]);
} else if (!empty($raw)) { } else if (!empty($raw)) {
echo $this->element('genericElements/Form/formLayouts/formDefault', [ echo $this->element('genericElements/Form/formLayouts/formDefault', [
'data' => $data,
'actionName' => $actionName, 'actionName' => $actionName,
'modelName' => $modelName, 'modelName' => $modelName,
'submitButtonData' => $submitButtonData, 'submitButtonData' => $submitButtonData,
@ -135,6 +137,7 @@
]); ]);
} else { } else {
echo $this->element('genericElements/Form/formLayouts/formDefault', [ echo $this->element('genericElements/Form/formLayouts/formDefault', [
'data' => $data,
'actionName' => $actionName, 'actionName' => $actionName,
'modelName' => $modelName, 'modelName' => $modelName,
'submitButtonData' => $submitButtonData, 'submitButtonData' => $submitButtonData,

View File

@ -37,6 +37,9 @@ foreach ($metaTemplate->meta_template_fields as $metaTemplateField) {
} else { } else {
$fieldData['field'] = sprintf('MetaTemplates.%s.meta_template_fields.%s.metaFields.%s.value', $metaField->meta_template_id, $metaField->meta_template_field_id, array_key_first($metaTemplateField->metaFields)); $fieldData['field'] = sprintf('MetaTemplates.%s.meta_template_fields.%s.metaFields.%s.value', $metaField->meta_template_id, $metaField->meta_template_field_id, array_key_first($metaTemplateField->metaFields));
} }
if ($metaTemplateField->type === 'boolean') {
$fieldData['type'] = 'checkbox';
}
$this->Form->setTemplates($backupTemplates); $this->Form->setTemplates($backupTemplates);
$fieldsHtml .= $this->element( $fieldsHtml .= $this->element(
'genericElements/Form/fieldScaffold', 'genericElements/Form/fieldScaffold',
@ -64,6 +67,9 @@ foreach ($metaTemplate->meta_template_fields as $metaTemplateField) {
'field' => sprintf('MetaTemplates.%s.meta_template_fields.%s.metaFields.new.0', $metaTemplateField->meta_template_id, $metaTemplateField->id), 'field' => sprintf('MetaTemplates.%s.meta_template_fields.%s.metaFields.new.0', $metaTemplateField->meta_template_id, $metaTemplateField->id),
'label' => $metaTemplateField->label, 'label' => $metaTemplateField->label,
]; ];
if ($metaTemplateField->type === 'boolean') {
$fieldData['type'] = 'checkbox';
}
$fieldsHtml .= $this->element( $fieldsHtml .= $this->element(
'genericElements/Form/fieldScaffold', 'genericElements/Form/fieldScaffold',
[ [