35 if (!empty($conf[
'if.']) && !$this->cObj->checkIf($conf[
'if.'])) {
39 $originalFileInContentObject = $this->cObj->getCurrentFile();
42 $fileObjects = $fileCollector->getFiles();
43 $availableFileObjectCount = count($fileObjects);
46 $splitConf = GeneralUtility::makeInstance(TypoScriptService::class)
47 ->explodeConfigurationForOptionSplit($conf, $availableFileObjectCount);
50 if (!empty($conf[
'begin'])) {
51 $start = (int)$conf[
'begin'];
53 if (!empty($conf[
'begin.'])) {
54 $start = (int)$this->cObj->stdWrap($start, $conf[
'begin.']);
58 $limit = $availableFileObjectCount;
59 if (!empty($conf[
'maxItems'])) {
60 $limit = (int)$conf[
'maxItems'];
62 if (!empty($conf[
'maxItems.'])) {
63 $limit = (int)$this->cObj->stdWrap($limit, $conf[
'maxItems.']);
69 $GLOBALS[
'TSFE']->register[
'FILES_COUNT'] = min($limit, $availableFileObjectCount);
71 $fileObjectCounter = 0;
72 $keys = array_keys($fileObjects);
75 for ($i = $start; $i < $end; $i++) {
77 $fileObject = $fileObjects[$key];
80 $GLOBALS[
'TSFE']->register[
'FILE_NUM_CURRENT'] = $fileObjectCounter;
82 $this->cObj->setCurrentFile($fileObject);
83 $content .= $this->cObj->cObjGetSingle($splitConf[$key][
'renderObj'], $splitConf[$key][
'renderObj.'],
'renderObj');
89 $this->cObj->setCurrentFile($originalFileInContentObject);
91 return $this->cObj->stdWrap($content, $conf[
'stdWrap.'] ?? []);
106 if ((isset($conf[
'references']) && $conf[
'references']) || (isset($conf[
'references.']) && $conf[
'references.'])) {
118 $referencesUidList = $this->cObj->stdWrapValue(
'references', $conf);
119 $referencesUids = GeneralUtility::intExplode(
',', $referencesUidList,
true);
120 $fileCollector->addFileReferences($referencesUids);
122 if (!empty($conf[
'references.'])) {
127 if ((isset($conf[
'files']) && $conf[
'files']) || (isset($conf[
'files.']) && $conf[
'files.'])) {
134 $fileUids = GeneralUtility::intExplode(
',', $this->cObj->stdWrapValue(
'files', $conf),
true);
135 $fileCollector->addFiles($fileUids);
138 if ((isset($conf[
'collections']) && $conf[
'collections']) || (isset($conf[
'collections.']) && $conf[
'collections.'])) {
139 $collectionUids = GeneralUtility::intExplode(
',', $this->cObj->stdWrapValue(
'collections', $conf),
true);
140 $fileCollector->addFilesFromFileCollections($collectionUids);
143 if ((isset($conf[
'folders']) && $conf[
'folders']) || (isset($conf[
'folders.']) && $conf[
'folders.'])) {
144 $folderIdentifiers = GeneralUtility::trimExplode(
',', $this->cObj->stdWrapValue(
'folders', $conf));
145 $fileCollector->addFilesFromFolders($folderIdentifiers, !empty($conf[
'folders.'][
'recursive']));
149 $sortingProperty =
'';
150 if ((isset($conf[
'sorting']) && $conf[
'sorting']) || (isset($conf[
'sorting.']) && $conf[
'sorting.'])) {
151 $sortingProperty = $this->cObj->stdWrapValue(
'sorting', $conf);
153 if ($sortingProperty !==
'') {
154 $sortingDirection = $conf[
'sorting.'][
'direction'] ??
'';
155 if (isset($conf[
'sorting.'][
'direction.'])) {
156 $sortingDirection = $this->cObj->stdWrap($sortingDirection, $conf[
'sorting.'][
'direction.']);
158 $fileCollector->sort($sortingProperty, $sortingDirection);
161 return $fileCollector;
175 $referencesFieldName = $this->cObj->stdWrapValue(
'fieldName', $configuration[
'references.']);
178 if (empty($referencesFieldName)) {
182 $currentId = !empty($element[
'uid']) ? $element[
'uid'] : 0;
183 $tableName = $this->cObj->getCurrentTable();
186 $referencesForeignTable = $this->cObj->stdWrapValue(
'table', $configuration[
'references.'], $tableName);
187 $referencesForeignUid = $this->cObj->stdWrapValue(
'uid', $configuration[
'references.'], $currentId);
191 if ($referencesForeignTable !== $tableName || $referencesForeignUid !== $currentId) {
192 $element = $pageRepository->getRawRecord($referencesForeignTable, $referencesForeignUid);
194 $pageRepository->versionOL($referencesForeignTable, $element,
true);
195 if (is_array($element)) {
196 $element = $pageRepository->getLanguageOverlay($referencesForeignTable, $element);
200 if (is_array($element)) {
218 return GeneralUtility::makeInstance(FileCollector::class);