/** * @param SourceItem $sourceItem * * @return null|string */ protected function getPreviewImageUrl(SourceItem $sourceItem) { $imageFileName = 'pageType.' . self::PREVIEW_IMAGE_EXTENSION; $imageFilePath = FS::joinPath($sourceItem->getDirectory(), self::PREVIEW_IMAGE_SUBDIRECTORY, $imageFileName); if (!file_exists($imageFilePath)) { return null; } return $sourceItem->getUrl() . '/' . self::PREVIEW_IMAGE_SUBDIRECTORY . '/' . $imageFileName; }
/** * @param SourceItem $sourceItem * @param string $newId * @param string $subdirectory * * @return SourceItem */ public function createSubdirSourceItem(SourceItem $sourceItem, $newId, $subdirectory) { return new SourceItem($newId, FS::joinPath($sourceItem->getDirectory(), $subdirectory, $newId), $sourceItem->getUrl() . '/' . $subdirectory . '/' . $newId, $sourceItem->getType(), $sourceItem->isReadonly(), false); }