getMediaDefaultFolderId example

/** * @return array<string, mixed> */
    private function updateMediaInConfiguration(
        ?ThemeEntity $theme,
        StorefrontPluginConfiguration $pluginConfiguration,
        Context $context
    ): array {
        $media = [];
        $themeData = [];
        $themeFolderId = $this->getMediaDefaultFolderId($context);

        $installedConfiguration = null;
        if ($theme && \is_array($theme->getThemeJson()) && $this->pluginConfigurationFactory) {
            $installedConfiguration = $this->pluginConfigurationFactory->createFromThemeJson(
                $theme->getTechnicalName() ?? 'childTheme',
                $theme->getThemeJson(),
                $pluginConfiguration->getBasePath(),
                false
            );
        }

        
 {
    }

    public function createMediaInFolder(string $folder, Context $context, bool $private = true): string
    {
        $mediaId = Uuid::randomHex();
        $this->mediaRepository->create(
            [
                [
                    'id' => $mediaId,
                    'private' => $private,
                    'mediaFolderId' => $this->getMediaDefaultFolderId($folder$context),
                ],
            ],
            $context
        );

        return $mediaId;
    }

    public function saveMediaFile(
        MediaFile $mediaFile,
        string $filename,
        
Home | Imprint | This part of the site doesn't use cookies.