diff --git a/Classes/ServiceProvider.php b/Classes/ServiceProvider.php new file mode 100644 index 000000000..2efdfb695 --- /dev/null +++ b/Classes/ServiceProvider.php @@ -0,0 +1,79 @@ + [ static::class, 'configureSetCollector' ], + ] + parent::getExtensions(); + } + + public static function configureSetCollector(ContainerInterface $container, SetCollector $setCollector, ?string $path = null): SetCollector + { + $setCollector = parent::configureSetCollector($container, $setCollector, $path); + $availableSets = $setCollector->getSetDefinitions(); + $bpFullSet = $availableSets['bootstrap-package/full'] ?? null; + if ($bpFullSet === null) { + return $setCollector; + } + + $optionalDependencies = []; + if (isset($availableSets['typo3/form'])) { + $optionalDependencies[] = 'bootstrap-package/ext-form'; + } + if (isset($availableSets['typo3/seo-sitemap'])) { + $optionalDependencies[] = 'bootstrap-package/ext-seo'; + } + if (isset($availableSets['typo3/indexed-search'])) { + $optionalDependencies[] = 'bootstrap-package/ext-indexed-search'; + } + if ($container->get(PackageManager::class)->isPackageActive('container')) { + $optionalDependencies[] = 'bootstrap-package/ext-container'; + } + + $setCollector->add( + new SetDefinition(...[ + ...$bpFullSet->toArray(), + 'dependencies' => [ + ...$bpFullSet->dependencies, + ...$optionalDependencies, + ], + ]) + ); + return $setCollector; + } +} diff --git a/Configuration/Sets/ExtContainer/config.yaml b/Configuration/Sets/ExtContainer/config.yaml new file mode 100644 index 000000000..ecc037a9d --- /dev/null +++ b/Configuration/Sets/ExtContainer/config.yaml @@ -0,0 +1,2 @@ +name: bootstrap-package/ext-container +label: 'Bootstrap Package: EXT:container integration' diff --git a/Configuration/Sets/ExtContainer/setup.typoscript b/Configuration/Sets/ExtContainer/setup.typoscript new file mode 100644 index 000000000..d369d2b06 --- /dev/null +++ b/Configuration/Sets/ExtContainer/setup.typoscript @@ -0,0 +1 @@ +@import 'EXT:bootstrap_package/Configuration/TypoScript/Extension/Container/setup.typoscript' diff --git a/Configuration/Sets/ExtForm/config.yaml b/Configuration/Sets/ExtForm/config.yaml new file mode 100644 index 000000000..dd84d54d5 --- /dev/null +++ b/Configuration/Sets/ExtForm/config.yaml @@ -0,0 +1,4 @@ +name: bootstrap-package/ext-form +label: 'Bootstrap Package: EXT:form integration' +dependencies: + - typo3/form diff --git a/Configuration/Sets/ExtIndexedSearch/config.yaml b/Configuration/Sets/ExtIndexedSearch/config.yaml new file mode 100644 index 000000000..a650b183a --- /dev/null +++ b/Configuration/Sets/ExtIndexedSearch/config.yaml @@ -0,0 +1,4 @@ +name: bootstrap-package/ext-indexed-search +label: 'Bootstrap Package: EXT:indexed_search integration' +dependencies: + - typo3/indexed-search diff --git a/Configuration/Sets/ExtIndexedSearch/setup.typoscript b/Configuration/Sets/ExtIndexedSearch/setup.typoscript new file mode 100644 index 000000000..69b0f36ef --- /dev/null +++ b/Configuration/Sets/ExtIndexedSearch/setup.typoscript @@ -0,0 +1,16 @@ +plugin.tx_indexedsearch { + view { + templateRootPaths { + 20 = EXT:bootstrap_package/Resources/Private/Templates/IndexedSearch/ + 21 = {$plugin.bootstrap_package.view.templateRootPath}IndexedSearch/ + } + partialRootPaths { + 20 = EXT:bootstrap_package/Resources/Private/Partials/IndexedSearch/ + 21 = {$plugin.bootstrap_package.view.partialRootPath}IndexedSearch/ + } + layoutRootPaths { + 20 = EXT:bootstrap_package/Resources/Private/Layouts/IndexedSearch/ + 21 = {$plugin.bootstrap_package.view.layoutRootPath}IndexedSearch/ + } + } +} diff --git a/Configuration/Sets/ExtSeo/config.yaml b/Configuration/Sets/ExtSeo/config.yaml new file mode 100644 index 000000000..963c936cd --- /dev/null +++ b/Configuration/Sets/ExtSeo/config.yaml @@ -0,0 +1,4 @@ +name: bootstrap-package/ext-seo +label: 'Bootstrap Package: EXT:seo integration' +dependencies: + - typo3/seo-sitemap diff --git a/Configuration/Sets/ExtSeo/setup.typoscript b/Configuration/Sets/ExtSeo/setup.typoscript new file mode 100644 index 000000000..ebdfcd619 --- /dev/null +++ b/Configuration/Sets/ExtSeo/setup.typoscript @@ -0,0 +1,16 @@ +plugin.tx_seo { + view { + templateRootPaths { + 20 = EXT:bootstrap_package/Resources/Private/Templates/Seo/ + 21 = {$plugin.bootstrap_package.view.templateRootPath}Seo/ + } + partialRootPaths { + 20 = EXT:bootstrap_package/Resources/Private/Partials/Seo/ + 21 = {$plugin.bootstrap_package.view.partialRootPath}Seo/ + } + layoutRootPaths { + 20 = EXT:bootstrap_package/Resources/Private/Layouts/Seo/ + 21 = {$plugin.bootstrap_package.view.layoutRootPath}Seo/ + } + } +} diff --git a/Configuration/Sets/Full/config.yaml b/Configuration/Sets/Full/config.yaml index 2e1d0ecc3..afbbdbda5 100644 --- a/Configuration/Sets/Full/config.yaml +++ b/Configuration/Sets/Full/config.yaml @@ -7,3 +7,8 @@ dependencies: - bootstrap-package/google-font - bootstrap-package/google-tag-manager - bootstrap-package/skiplink + # optional dependencies added by ServiceProvider + # - bootstrap-package/ext-form + # - bootstrap-package/ext-indexed-search + # - bootstrap-package/ext-seo-sitemap + # - bootstrap-package/ext-container diff --git a/Configuration/Sets/Full/setup.typoscript b/Configuration/Sets/Full/setup.typoscript index 0d5bc7e76..4d3e364fd 100644 --- a/Configuration/Sets/Full/setup.typoscript +++ b/Configuration/Sets/Full/setup.typoscript @@ -1,6 +1,3 @@ -# DEPENDENCIES -@import 'EXT:bootstrap_package/Configuration/TypoScript/Extension/setup.typoscript' - # HELPER @import 'EXT:bootstrap_package/Configuration/TypoScript/Helper/Block.typoscript' @import 'EXT:bootstrap_package/Configuration/TypoScript/Helper/PageClass.typoscript' diff --git a/composer.json b/composer.json index dec5c108f..36d24eb3b 100644 --- a/composer.json +++ b/composer.json @@ -80,6 +80,9 @@ }, "typo3/cms": { "extension-key": "bootstrap_package", + "Package": { + "serviceProvider": "BK2K\\BootstrapPackage\\ServiceProvider" + }, "web-dir": ".build/public" } },