getIsTheme example

return $sorted;
    }

    private function isTheme(string $bundle): bool
    {
        $themeConfig = $this->themeRegistry->getConfigurations()->getByTechnicalName($bundle);

        if ($themeConfig === null) {
            return false;
        }

        if ($themeConfig->getIsTheme()) {
            return true;
        }

        if ($bundle === StorefrontPluginRegistry::BASE_THEME_NAME) {
            return true;
        }

        return false;
    }
}
private readonly StorefrontPluginRegistryInterface $storefrontPluginRegistry,
        private readonly Connection $connection
    ) {
    }

    public function handleThemeInstallOrUpdate(
        StorefrontPluginConfiguration $config,
        StorefrontPluginConfigurationCollection $configurationCollection,
        Context $context
    ): void {
        $themeId = null;
        if ($config->getIsTheme()) {
            $this->themeLifecycleService->refreshTheme($config$context);
            $themeData = $this->getThemeDataByTechnicalName($config->getTechnicalName());
            $themeId = $themeData->getId();
            $this->changeThemeActive($themeData, true, $context);
        }

        $this->recompileThemesIfNecessary($config$context$configurationCollection$themeId);
    }

    public function handleThemeUninstall(StorefrontPluginConfiguration $config, Context $context): void
    {
        
$this->set($element->getTechnicalName()$element);
    }

    public function getByTechnicalName(string $name): ?StorefrontPluginConfiguration
    {
        return $this->filter(fn (StorefrontPluginConfiguration $config) => $config->getTechnicalName() === $name)->first();
    }

    public function getThemes(): StorefrontPluginConfigurationCollection
    {
        return $this->filter(fn (StorefrontPluginConfiguration $configuration) => $configuration->getIsTheme());
    }

    public function getNoneThemes(): StorefrontPluginConfigurationCollection
    {
        return $this->filter(fn (StorefrontPluginConfiguration $configuration) => !$configuration->getIsTheme());
    }

    protected function getExpectedClass(): ?string
    {
        return StorefrontPluginConfiguration::class;
    }
}

        /** @var string $basePath */
        $basePath = realpath(__DIR__ . '/../fixtures/ThemeConfig');

        $theme = $this->getBundle('TestTheme', $basePath, true);
        $config = $this->configFactory->createFromBundle($theme);

        $basePath = $this->stripProjectDir($basePath);

        static::assertEquals('TestTheme', $config->getTechnicalName());
        static::assertEquals($basePath . '/Resources', $config->getBasePath());
        static::assertTrue($config->getIsTheme());
        static::assertEquals(
            $basePath . '/Resources/app/storefront/src/main.js',
            $config->getStorefrontEntryFilepath()
        );
        $this->assertFileCollection([
            $basePath . '/Resources/app/storefront/src/scss/overrides.scss' => [],
            '@Storefront' => [],
            $basePath . '/Resources/app/storefront/src/scss/base.scss' => [
                'vendor' => $basePath . '/Resources/app/storefront/vendor',
            ],
        ]$config->getStyleFiles());
        
Home | Imprint | This part of the site doesn't use cookies.