Skip to content

Commit

Permalink
[BUGFIX] Load correct cType list in item proc hook
Browse files Browse the repository at this point in the history
If two fields of type content exist, always the first one was selected
for the cType list regardless of the parent table they belong to.

There is no optimal way right now to figure out the parent table, so the
creation string which contains the parent table is parsed.

Fixes: #382
  • Loading branch information
nhovratov committed Feb 7, 2021
1 parent 11173b3 commit cb7ee9f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Classes/ItemsProcFuncs/CTypeList.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,15 @@ public function itemsProcFunc(&$params): void
}
}

$dataString = $GLOBALS['TYPO3_REQUEST']->getParsedBody()['ajax'][0] ?? '';
if (preg_match_all('/tx_mask_\w+/', $dataString, $pregResult) && count($pregResult[0]) > 1) {
// Get the second last entry
$table = $pregResult[0][count($pregResult[0]) - 2];
} else {
$table = $this->fieldHelper->getFieldType($fieldKey);
}

// load the json configuration of this field
$table = $this->fieldHelper->getFieldType($fieldKey);
$fieldConfiguration = $this->storageRepository->loadField($table, $fieldKey);

// if there is a restriction of cTypes specified
Expand Down

0 comments on commit cb7ee9f

Please sign in to comment.