diff --git a/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php b/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php index f75b65f273ef0d875222399c353e043c440ed27d..4db2e9ad9366fd16f329658eac8dc2cf348b3c52 100644 --- a/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php +++ b/typo3/sysext/backend/Classes/Form/FormDataProvider/AbstractItemProvider.php @@ -889,14 +889,19 @@ abstract class AbstractItemProvider $parsedSiteConfiguration = $this->parseSiteConfiguration($result['site'], $fieldConfig['config']['treeConfig']['startingPoints']); if ($parsedSiteConfiguration !== []) { // $this->quoteParsedSiteConfiguration() is omitted on purpose, all values are cast to integers - $parsedSiteConfiguration = array_unique(array_map(static function ($value) { + $parsedSiteConfiguration = array_unique(array_map(static function ($value): string { if (is_array($value)) { return implode(',', array_map('intval', $value)); } - return (int)$value; + return implode(',', GeneralUtility::intExplode(',', $value, true)); }, $parsedSiteConfiguration)); - $fieldConfig['config']['treeConfig']['startingPoints'] = $this->replaceParsedSiteConfiguration($fieldConfig['config']['treeConfig']['startingPoints'], $parsedSiteConfiguration); + $resolvedStartingPoins = $this->replaceParsedSiteConfiguration($fieldConfig['config']['treeConfig']['startingPoints'], $parsedSiteConfiguration); + // Add the resolved starting points while removing empty values + $fieldConfig['config']['treeConfig']['startingPoints'] = implode( + ',', + GeneralUtility::trimExplode(',', $resolvedStartingPoins, true) + ); } return $fieldConfig; diff --git a/typo3/sysext/backend/Tests/Functional/Form/FormDataProvider/TcaCategoryTest.php b/typo3/sysext/backend/Tests/Functional/Form/FormDataProvider/TcaCategoryTest.php index b5632a351f91809f1e8981278368458587c8ebf9..364629c6ea53d3c31b84b5c54264a6905f9833e8 100644 --- a/typo3/sysext/backend/Tests/Functional/Form/FormDataProvider/TcaCategoryTest.php +++ b/typo3/sysext/backend/Tests/Functional/Form/FormDataProvider/TcaCategoryTest.php @@ -191,16 +191,31 @@ class TcaCategoryTest extends FunctionalTestCase 'expectedStartingPoints' => '42,4711,12', 'site' => new Site('some-site', 1, ['rootPageId' => 1, 'categories' => ['contentCategory' => 4711]]), ], - 'one setting, multiple categories' => [ + 'one setting, multiple categories as array' => [ 'inputStartingPoints' => '###SITE:categories.contentCategories###', 'expectedStartingPoints' => '4711,4712,42', 'site' => new Site('some-site', 1, ['rootPageId' => 1, 'categories' => ['contentCategories' => [4711, 4712, 42]]]), ], + 'one setting, multiple categories as csv' => [ + 'inputStartingPoints' => '###SITE:categories.contentCategories###', + 'expectedStartingPoints' => '4711,4712,42', + 'site' => new Site('some-site', 1, ['rootPageId' => 1, 'categories' => ['contentCategories' => '4711,4712,42']]), + ], 'two settings' => [ 'inputStartingPoints' => '42,###SITE:categories.contentCategory###,12,###SITE:foobar###', 'expectedStartingPoints' => '42,4711,12,1', 'site' => new Site('some-site', 1, ['rootPageId' => 1, 'foobar' => 1, 'categories' => ['contentCategory' => 4711]]), ], + 'one invalid settings' => [ + 'inputStartingPoints' => '42,12,###SITE:invalid###', + 'expectedStartingPoints' => '42,12', + 'site' => new Site('some-site', 1, ['rootPageId' => 1]), + ], + 'one valid and one invalid setting' => [ + 'inputStartingPoints' => '42,###SITE:invalid###,12,###SITE:categories.contentCategory###', + 'expectedStartingPoints' => '42,12,4711,4712', + 'site' => new Site('some-site', 1, ['rootPageId' => 1, 'categories' => ['contentCategory' => '4711,4712']]), + ], ]; }