folder instanceof Folder) { $entries = $this->folder->getFiles(0, 0, Folder::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS, $this->recursive); foreach ($entries as $entry) { $this->add($entry); } } } /** * Gets the items criteria. * * @return string */ public function getItemsCriteria() { return $this->folder->getCombinedIdentifier(); } /** * Returns an array of the persistable properties and contents * which are processable by DataHandler. * * @return array */ protected function getPersistableDataArray() { return [ 'title' => $this->getTitle(), 'type' => self::$type, 'description' => $this->getDescription(), 'folder_identifier' => $this->folder->getCombinedIdentifier(), ]; } /** * Similar to method in \TYPO3\CMS\Core\Collection\AbstractRecordCollection, * but without $this->itemTableName= $array['table_name'], * but with $this->storageItemsFieldContent = $array[self::$storageItemsField]; */ public function fromArray(array $array) { $this->uid = (int)$array['uid']; $this->title = (string)$array['title']; $this->description = (string)$array['description']; $this->recursive = (bool)$array['recursive']; if (str_contains($array['folder_identifier'] ?? '', ':')) { $parts = GeneralUtility::trimExplode(':', $array['folder_identifier']); $storageRepository = GeneralUtility::makeInstance(StorageRepository::class); $storage = $storageRepository->findByUid((int)$parts[0]); if ($storage) { $this->folder = $storage->getFolder($parts[1]); } } } }