Skip to content
This repository was archived by the owner on Jul 29, 2025. It is now read-only.

Commit 90ec55e

Browse files
committed
[FEATURE] Add overwriteable namespaces (relates to sitegeist/fluid-components#178)
1 parent 542c7e7 commit 90ec55e

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

Classes/Domain/Repository/PackageRepository.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,21 @@ public function findAll(): array
2525
$fluidNamespaces = $this->getViewHelperResolver()->getNamespaces();
2626
$componentNamespaces = $this->componentLoader->getNamespaces();
2727
$packages = [];
28-
foreach ($componentNamespaces as $namespace => $path) {
29-
$matchingNamespaceAlias = '???';
30-
foreach ($fluidNamespaces as $namespaceAlias => $namespaceCandidates) {
31-
if (in_array($namespace, $namespaceCandidates)) {
32-
$matchingNamespaceAlias = $namespaceAlias;
33-
break;
28+
foreach ($componentNamespaces as $namespace => $paths) {
29+
foreach ($paths as $path) {
30+
$matchingNamespaceAlias = '???';
31+
foreach ($fluidNamespaces as $namespaceAlias => $namespaceCandidates) {
32+
if (in_array($namespace, $namespaceCandidates)) {
33+
$matchingNamespaceAlias = $namespaceAlias;
34+
break;
35+
}
3436
}
37+
$packages[] = new Package(
38+
$namespace,
39+
$matchingNamespaceAlias,
40+
$path
41+
);
3542
}
36-
37-
$packages[] = new Package(
38-
$namespace,
39-
$matchingNamespaceAlias,
40-
$path
41-
);
4243
}
4344

4445
return $packages;

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ To add your own components to the styleguide, just follow these additional steps
5555
Make sure to define the component namespace in your **ext_localconf.php**:
5656

5757
```php
58-
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['fluid_components']['namespaces']['VENDOR\\MyExtension\\Components'] =
58+
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['fluid_components']['namespaces']['VENDOR\\MyExtension\\Components'][] =
5959
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('my_extension', 'Resources/Private/Components');
6060
```
6161

ext_localconf.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<?php
22

3+
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
4+
35
call_user_func(function () {
46
// Register component namespace
5-
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['fluid_components']['namespaces']['Sitegeist\\FluidStyleguide\\Components'] =
6-
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('fluid_styleguide', 'Resources/Private/Components');
7+
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['fluid_components']['namespaces']['Sitegeist\\FluidStyleguide\\Components'][] =
8+
ExtensionManagementUtility::extPath('fluid_styleguide', 'Resources/Private/Components');
79
});

0 commit comments

Comments
 (0)