-
-
Notifications
You must be signed in to change notification settings - Fork 15
[FEATURE] Configure inventories via guides.xml #586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,18 @@ public function getConfigTreeBuilder(): TreeBuilder | |
->scalarNode('version')->end() | ||
->end() | ||
->end() | ||
->arrayNode('inventories') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could also make this mode a prototyped array node. And add This creates a config like <guides>
<inventory>...</inventory>
<inventory>...</inventory>
</guides> And produces an array This is the common approach used by Symfony bundles when dealing with prototype nodes. |
||
->children() | ||
->arrayNode('inventory') | ||
->arrayPrototype() | ||
->children() | ||
->scalarNode('id')->end() | ||
->scalarNode('url')->end() | ||
->end() | ||
->end() | ||
->end() | ||
->end() | ||
->end() | ||
->scalarNode('html_theme')->end() | ||
->arrayNode('base_template_paths') | ||
->defaultValue([]) | ||
|
@@ -79,13 +91,22 @@ public function load(array $configs, ContainerBuilder $container): void | |
$loader->load('command_bus.php'); | ||
$loader->load('guides.php'); | ||
|
||
$projectSettings = []; | ||
if (isset($config['project'])) { | ||
if (isset($config['project']['version'])) { | ||
$config['project']['version'] = (string) $config['project']['version']; | ||
} | ||
|
||
$projectSettings = $config['project']; | ||
} | ||
|
||
if (isset($config['inventories'])) { | ||
$projectSettings['inventories'] = $config['inventories']['inventory']; | ||
} | ||
|
||
if ($projectSettings) { | ||
$container->getDefinition(SettingsManager::class) | ||
->addMethodCall('setProjectSettings', [new ProjectSettings($config['project'])]); | ||
->addMethodCall('setProjectSettings', [new ProjectSettings($projectSettings)]); | ||
} | ||
|
||
if (isset($config['html_theme'])) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<guides> | ||
<project title="My Project" version="main (development)" /> | ||
<inventories> | ||
<inventory id="t3coreapi" url="https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/" /> | ||
<inventory id="someapi" url="https://docs.typo3.org/m/typo3/reference-someapi/main/en-us/" /> | ||
</inventories> | ||
</guides> |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<guides> | ||
<project title="My Project" version="main (development)" /> | ||
<inventories> | ||
<inventory id="t3coreapi" url="https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/" /> | ||
<inventory id="t3home" url="https://docs.typo3.org/" /> | ||
</inventories> | ||
</guides> |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<guides> | ||
<project title="My Project" version="3.1.4" /> | ||
<inventories> | ||
<inventory id="t3coreapi" url="https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/" /> | ||
<inventory id="t3home" url="https://docs.typo3.org/" /> | ||
</inventories> | ||
</guides> |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only defines the (complex) type named
inventories
but it doesn't use the type anywhere.You need to also add
<xsd:element name="inventories" type="inventories">
add the top of this document.