chg: [genericElement:fieldScaffold] Let cake's form helper decide the input type if not specified

pull/121/head
Sami Mokaddem 2022-12-08 15:50:03 +01:00
parent b121399304
commit 21c5601c29
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 4 additions and 5 deletions

View File

@ -1,11 +1,10 @@
<?php <?php
if (is_array($fieldData)) { if (is_array($fieldData)) {
if (empty($fieldData['type'])) {
$fieldData['type'] = 'text';
}
$fieldTemplate = 'genericField'; $fieldTemplate = 'genericField';
if (file_exists(ROOT . '/templates/element/genericElements/Form/Fields/' . $fieldData['type'] . 'Field.php')) { if (!empty($fieldData['type'])) {
$fieldTemplate = $fieldData['type'] . 'Field'; if (file_exists(ROOT . '/templates/element/genericElements/Form/Fields/' . $fieldData['type'] . 'Field.php')) {
$fieldTemplate = $fieldData['type'] . 'Field';
}
} }
if (empty($fieldData['label'])) { if (empty($fieldData['label'])) {
if (!isset($fieldData['label']) || $fieldData['label'] !== false) { if (!isset($fieldData['label']) || $fieldData['label'] !== false) {