|
3 | 3 | /** |
4 | 4 | * This file is part of MetaModels/attribute_file. |
5 | 5 | * |
6 | | - * (c) 2012-2024 The MetaModels team. |
| 6 | + * (c) 2012-2025 The MetaModels team. |
7 | 7 | * |
8 | 8 | * For the full copyright and license information, please view the LICENSE |
9 | 9 | * file that was distributed with this source code. |
|
14 | 14 | * @author Christian Schiffler <[email protected]> |
15 | 15 | * @author Sven Baumann <[email protected]> |
16 | 16 | * @author Ingolf Steinhardt <[email protected]> |
17 | | - * @copyright 2012-2024 The MetaModels team. |
| 17 | + * @copyright 2012-2025 The MetaModels team. |
18 | 18 | * @license https://github.com/MetaModels/attribute_file/blob/master/LICENSE LGPL-3.0-or-later |
19 | 19 | * @filesource |
20 | 20 | */ |
21 | 21 |
|
22 | 22 | namespace MetaModels\AttributeFileBundle\DependencyInjection; |
23 | 23 |
|
| 24 | +use InspiredMinds\ContaoFileUsage\ContaoFileUsageBundle; |
24 | 25 | use MetaModels\AttributeFileBundle\EventListener\DcGeneral\Table\DcaSetting\FileWidgetModeOptions; |
25 | 26 | use MetaModels\ContaoFrontendEditingBundle\MetaModelsContaoFrontendEditingBundle; |
26 | 27 | use Symfony\Component\Cache\Adapter\ArrayAdapter; |
@@ -57,18 +58,23 @@ public function load(array $configs, ContainerBuilder $container): void |
57 | 58 | $config = $this->processConfiguration($configuration, $configs); |
58 | 59 | $this->buildCacheService($container, $config); |
59 | 60 |
|
60 | | - $frontendEditing = false; |
61 | | - |
62 | 61 | $bundles = $container->getParameter('kernel.bundles'); |
63 | 62 | assert(is_array($bundles)); |
64 | | - // Load configuration for the frontend editing. |
| 63 | + |
| 64 | + // Load configuration for the frontend editing extension. |
| 65 | + $frontendEditing = false; |
65 | 66 | if (in_array(MetaModelsContaoFrontendEditingBundle::class, $bundles, true)) { |
66 | 67 | $frontendEditing = true; |
67 | 68 | $loader->load('frontend_editing/event_listener.yml'); |
68 | 69 | } |
69 | | - |
70 | 70 | $this->addFrontendEditingArgument($container, $frontendEditing); |
71 | 71 |
|
| 72 | + // Load configuration for the file usage extension. |
| 73 | + if (in_array(ContaoFileUsageBundle::class, $bundles, true) && (bool) ($config['file_usage'] ?? false)) { |
| 74 | + $loader->load('file_usage/services.yml'); |
| 75 | + } |
| 76 | + |
| 77 | + // Schema manager |
72 | 78 | $typeNames = $container->hasParameter('metamodels.managed-schema-type-names') |
73 | 79 | ? $container->getParameter('metamodels.managed-schema-type-names') |
74 | 80 | : null; |
@@ -96,9 +102,9 @@ public function getConfiguration(array $config, ContainerBuilder $container): ?C |
96 | 102 | * |
97 | 103 | * @return void |
98 | 104 | */ |
99 | | - private function buildCacheService(ContainerBuilder $container, array $config) |
| 105 | + private function buildCacheService(ContainerBuilder $container, array $config): void |
100 | 106 | { |
101 | | - // if cache disabled, swap it out with the dummy cache. |
| 107 | + // If cache disabled, swap it out with the dummy cache. |
102 | 108 | if (!$config['enable_cache']) { |
103 | 109 | $cache = $container->getDefinition('metamodels.attribute_file.cache_system'); |
104 | 110 | $cache->setClass(ArrayAdapter::class); |
|
0 commit comments