33/**
44 * This file is part of MetaModels/attribute_translatedfile.
55 *
6- * (c) 2012-2024 The MetaModels team.
6+ * (c) 2012-2025 The MetaModels team.
77 *
88 * For the full copyright and license information, please view the LICENSE
99 * file that was distributed with this source code.
1414 * @author David Molineus <david.molineus@netzmacht.de>
1515 * @author Sven Baumann <baumann.sv@gmail.com>
1616 * @author Ingolf Steinhardt <info@e-spin.de>
17- * @copyright 2012-2024 The MetaModels team.
17+ * @copyright 2012-2025 The MetaModels team.
1818 * @license https://github.com/MetaModels/attribute_translatedfile/blob/master/LICENSE LGPL-3.0-or-later
1919 * @filesource
2020 */
2121
2222namespace MetaModels \AttributeTranslatedFileBundle \DependencyInjection ;
2323
24+ use InspiredMinds \ContaoFileUsage \ContaoFileUsageBundle ;
25+ use MetaModels \AttributeTranslatedFileBundle \DependencyInjection \Configuration ;
26+ use Symfony \Component \Config \Definition \ConfigurationInterface ;
2427use Symfony \Component \Config \FileLocator ;
2528use Symfony \Component \DependencyInjection \ContainerBuilder ;
2629use Symfony \Component \DependencyInjection \Extension \Extension ;
2730use Symfony \Component \DependencyInjection \Loader ;
2831
32+ use function assert ;
33+ use function in_array ;
34+ use function is_array ;
35+ use function is_bool ;
36+
2937/**
3038 * This is the class that loads and manages the bundle configuration
3139 *
@@ -43,13 +51,33 @@ public function load(array $configs, ContainerBuilder $container): void
4351 $ loader = new Loader \YamlFileLoader ($ container , new FileLocator (__DIR__ . '/../Resources/config ' ));
4452 $ loader ->load ('factory.yml ' );
4553 $ loader ->load ('event_listeners.yml ' );
46- $ loader ->load ('services.yml ' );
4754
55+ $ configuration = $ this ->getConfiguration ($ configs , $ container );
56+ assert ($ configuration instanceof Configuration);
57+ $ config = $ this ->processConfiguration ($ configuration , $ configs );
58+
59+ $ bundles = $ container ->getParameter ('kernel.bundles ' );
60+ assert (is_array ($ bundles ));
61+
62+ // Load configuration for the file usage extension.
63+ if (in_array (ContaoFileUsageBundle::class, $ bundles , true ) && (bool ) ($ config ['file_usage ' ] ?? false )) {
64+ $ loader ->load ('file_usage/services.yml ' );
65+ }
66+
67+ // Schema manager.
4868 $ typeNames = $ container ->hasParameter ('metamodels.managed-schema-type-names ' )
4969 ? $ container ->getParameter ('metamodels.managed-schema-type-names ' )
5070 : null ;
51- $ managedSchemaTypeNames = \ is_array ($ typeNames ) ? $ typeNames : [];
71+ $ managedSchemaTypeNames = is_array ($ typeNames ) ? $ typeNames : [];
5272 $ managedSchemaTypeNames [] = 'translatedfile ' ;
5373 $ container ->setParameter ('metamodels.managed-schema-type-names ' , $ managedSchemaTypeNames );
5474 }
75+
76+ /**
77+ * {@inheritDoc}
78+ */
79+ public function getConfiguration (array $ config , ContainerBuilder $ container ): ?ConfigurationInterface
80+ {
81+ return new Configuration ();
82+ }
5583}
0 commit comments