Skip to content

Commit

Permalink
fixed input type check in General::getFields()
Browse files Browse the repository at this point in the history
  • Loading branch information
koertho committed Sep 6, 2022
1 parent 1e7bc8b commit 0f5fc55
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All notable changes to this project will be documented in this file.

## [1.15.10] - 2022-09-06
- Fixed: General::getFields() inputType filter returned wrong values

## [1.15.9] - 2022-08-23
- Fixed: warnings in php 8

Expand Down
16 changes: 10 additions & 6 deletions library/Haste/Dca/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -537,19 +537,23 @@ public static function getFields(

$arrOptions = [];

$evaluateInputType = false;
if (!empty($varInputType)) {
if (is_string($varInputType)) {
$varInputType = [$varInputType];
}
$evaluateInputType = true;
}

foreach ($GLOBALS['TL_DCA'][$strTable]['fields'] as $strField => $arrData) {
// skip special fields
if (in_array($strField, $arrSkipFields)) {
continue;
}

// input type
if (!empty($varInputType)) {
if (
empty($arrData['inputType'])
|| (is_array($varInputType) && in_array($arrData['inputType'], $varInputType))
|| (is_string($varInputType) && ($arrData['inputType'] != $varInputType))
) {
if ($evaluateInputType) {
if (empty($arrData['inputType']) || !in_array($arrData['inputType'], $varInputType)) {
continue;
}
}
Expand Down

0 comments on commit 0f5fc55

Please sign in to comment.