Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Introduce site sets with setting definitions
Site sets ship parts of site configuration as composable pieces. They are intended to deliver settings, TypoScript, TSConfig and reference enabled content blocks for the scope of a site. Extensions can provide multiple sets in order to ship presets for different sites or subsets (think of frameworks) where selected features are exposed as a subset (example: `typo3/seo-xml-sitemap`). A set is defined in an extensions subfolder in :file:`Configuration/Sets/`, for example :file:`EXT:my_extension/Configuration/Sets/MySet/config.yaml`. The folder name in :file:`Configuration/Sets/` is arbitrary, significant is the `name` defined in :file:`config.yaml`. The `name` uses a `vendor/name` scheme by convention, and *should* use the same vendor as the containing extension. It may differ if needed for compatibility reasons (e.g. when sets are moved to other extensions). TypoScript and PageTS providers will be added in subsequent changes (#103439, #103522). Technical notes: * Sets whose dependencies can not be fullfilled (are unavailable) will log an error in the TYPO3 error log and will be ignored. This is to ensure a broken set of one site does not break another site, if their dependencies can be resolved. * All settings interfaces are marked @internal for now, since they may change until v13 LTS. It is planned to remove the @internal annotation prior to the LTS release. Releases: main Resolves: #103437 Related: #103439 Related: #103522 Change-Id: I01cf60a837a69ea2216c9d8cd5ec9fbacacb5ece Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82191 Tested-by: Benjamin Kott <benjamin.kott@outlook.com> Reviewed-by: Benjamin Franzke <ben@bnf.dev> Tested-by: Benni Mack <benni@typo3.org> Reviewed-by: Benni Mack <benni@typo3.org> Tested-by: Oliver Bartsch <bo@cedev.de> Tested-by: Benjamin Franzke <ben@bnf.dev> Tested-by: core-ci <typo3@b13.com> Reviewed-by: Benjamin Kott <benjamin.kott@outlook.com> Reviewed-by: Oliver Bartsch <bo@cedev.de>
- Loading branch information
Showing
48 changed files
with
2,342 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace TYPO3\CMS\Core\Command; | ||
|
||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Helper\Table; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Style\SymfonyStyle; | ||
use TYPO3\CMS\Core\Site\Set\SetCollector; | ||
|
||
/** | ||
* Command for listing all configured sites | ||
*/ | ||
class SiteSetsListCommand extends Command | ||
{ | ||
public function __construct( | ||
protected readonly SetCollector $setCollector | ||
) { | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Shows a table with all configured sites | ||
*/ | ||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$io = new SymfonyStyle($input, $output); | ||
$sets = $this->setCollector->getSetDefinitions(); | ||
|
||
if ($sets === []) { | ||
$io->title('No site sets configured'); | ||
$io->note('Configure new sites by placing a Configuration/Sets/MySetName/config.yaml in an extension.'); | ||
return Command::SUCCESS; | ||
} | ||
|
||
$io->title('All configured site sets'); | ||
$table = new Table($output); | ||
$table->setHeaders([ | ||
'Name', | ||
'Label', | ||
'Dependencies', | ||
]); | ||
foreach ($sets as $set) { | ||
$table->addRow( | ||
[ | ||
'<options=bold>' . $set->name . '</>', | ||
$set->label, | ||
implode(', ', [ | ||
...$set->dependencies, | ||
...array_map(static fn(string $d): string => '(' . $d . ')', $set->optionalDependencies), | ||
]), | ||
] | ||
); | ||
} | ||
$table->render(); | ||
return Command::SUCCESS; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace TYPO3\CMS\Core\Settings; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
readonly class SettingDefinition | ||
{ | ||
public function __construct( | ||
public string $key, | ||
public string $type, | ||
public string|int|float|bool|array|null $default, | ||
public string $label, | ||
public ?string $description = null, | ||
public array $enum = [], | ||
public array $categories = [], | ||
public array $tags = [], | ||
) {} | ||
|
||
public function toArray(): array | ||
{ | ||
return array_filter(get_object_vars($this), fn(mixed $value) => $value !== null && $value !== []); | ||
} | ||
|
||
public static function __set_state(array $state): self | ||
{ | ||
return new self(...$state); | ||
} | ||
} |
Oops, something went wrong.