Skip to content

Commit e8f4897

Browse files
committed
Fix services for file usage
1 parent b724f57 commit e8f4897

File tree

4 files changed

+26
-19
lines changed

4 files changed

+26
-19
lines changed

.composer-require-checker.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"Contao\\ManagerPlugin\\Bundle\\Parser\\ParserInterface",
88
"Contao\\ManagerPlugin\\Routing\\RoutingPluginInterface",
99
"MetaModels\\ContaoFrontendEditingBundle\\MetaModelsContaoFrontendEditingBundle",
10+
"InspiredMinds\\ContaoFileUsage\\ContaoFileUsageBundle",
1011
"InspiredMinds\\ContaoFileUsage\\Provider\\FileUsageProviderInterface",
1112
"InspiredMinds\\ContaoFileUsage\\Result\\FileTreeMultipleResult",
1213
"InspiredMinds\\ContaoFileUsage\\Result\\FileTreeSingleResult",

src/DependencyInjection/MetaModelsAttributeFileExtension.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of MetaModels/attribute_file.
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.
@@ -14,13 +14,14 @@
1414
* @author Christian Schiffler <[email protected]>
1515
* @author Sven Baumann <[email protected]>
1616
* @author Ingolf Steinhardt <[email protected]>
17-
* @copyright 2012-2024 The MetaModels team.
17+
* @copyright 2012-2025 The MetaModels team.
1818
* @license https://github.com/MetaModels/attribute_file/blob/master/LICENSE LGPL-3.0-or-later
1919
* @filesource
2020
*/
2121

2222
namespace MetaModels\AttributeFileBundle\DependencyInjection;
2323

24+
use InspiredMinds\ContaoFileUsage\ContaoFileUsageBundle;
2425
use MetaModels\AttributeFileBundle\EventListener\DcGeneral\Table\DcaSetting\FileWidgetModeOptions;
2526
use MetaModels\ContaoFrontendEditingBundle\MetaModelsContaoFrontendEditingBundle;
2627
use Symfony\Component\Cache\Adapter\ArrayAdapter;
@@ -57,18 +58,23 @@ public function load(array $configs, ContainerBuilder $container): void
5758
$config = $this->processConfiguration($configuration, $configs);
5859
$this->buildCacheService($container, $config);
5960

60-
$frontendEditing = false;
61-
6261
$bundles = $container->getParameter('kernel.bundles');
6362
assert(is_array($bundles));
64-
// Load configuration for the frontend editing.
63+
64+
// Load configuration for the frontend editing extension.
65+
$frontendEditing = false;
6566
if (in_array(MetaModelsContaoFrontendEditingBundle::class, $bundles, true)) {
6667
$frontendEditing = true;
6768
$loader->load('frontend_editing/event_listener.yml');
6869
}
69-
7070
$this->addFrontendEditingArgument($container, $frontendEditing);
7171

72+
// Load configuration for the file usage extension.
73+
if (in_array(ContaoFileUsageBundle::class, $bundles, true)) {
74+
$loader->load('file_usage/services.yml');
75+
}
76+
77+
// Schema manager
7278
$typeNames = $container->hasParameter('metamodels.managed-schema-type-names')
7379
? $container->getParameter('metamodels.managed-schema-type-names')
7480
: null;
@@ -96,9 +102,9 @@ public function getConfiguration(array $config, ContainerBuilder $container): ?C
96102
*
97103
* @return void
98104
*/
99-
private function buildCacheService(ContainerBuilder $container, array $config)
105+
private function buildCacheService(ContainerBuilder $container, array $config): void
100106
{
101-
// if cache disabled, swap it out with the dummy cache.
107+
// If cache disabled, swap it out with the dummy cache.
102108
if (!$config['enable_cache']) {
103109
$cache = $container->getDefinition('metamodels.attribute_file.cache_system');
104110
$cache->setClass(ArrayAdapter::class);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
services:
2+
# MetaModels\AttributeFileBundle\FileUsage\FileUsageProvider:
3+
# public: true
4+
# arguments:
5+
# $factory: '@metamodels.factory'
6+
# $urlGenerator: '@router'
7+
# $requestStack: '@request_stack'
8+
# $csrfTokenManager: '@contao.csrf.token_manager'
9+
# $csrfTokenName: '%contao.csrf_token_name%'
10+
# tags:
11+
# - { name: contao_file_usage.provider }

src/Resources/config/services.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,3 @@ services:
3232
- '@metamodels.table_manipulator'
3333
tags:
3434
- name: contao.migration
35-
36-
MetaModels\AttributeFileBundle\FileUsage\FileUsageProvider:
37-
public: true
38-
arguments:
39-
$factory: '@metamodels.factory'
40-
$urlGenerator: '@router'
41-
$requestStack: '@request_stack'
42-
$csrfTokenManager: '@contao.csrf.token_manager'
43-
$csrfTokenName: '%contao.csrf_token_name%'
44-
tags:
45-
- { name: contao_file_usage.provider }

0 commit comments

Comments
 (0)