Skip to content

Commit 2eaa91d

Browse files
committed
Merge tag '2.3.1'
Fixes: - bugfix for file usage extension
2 parents 78c9b26 + 1e905d5 commit 2eaa91d

File tree

5 files changed

+32
-23
lines changed

5 files changed

+32
-23
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/Configuration.php

Lines changed: 6 additions & 4 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-2023 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.
@@ -13,7 +13,7 @@
1313
* @package MetaModels/attribute_file
1414
* @author Sven Baumann <baumann.sv@gmail.com>
1515
* @author Ingolf Steinhardt <info@e-spin.de>
16-
* @copyright 2012-2023 The MetaModels team.
16+
* @copyright 2012-2025 The MetaModels team.
1717
* @license https://github.com/MetaModels/attribute_file/blob/master/LICENSE LGPL-3.0-or-later
1818
* @filesource
1919
*/
@@ -45,7 +45,7 @@ final class Configuration implements ConfigurationInterface
4545
*/
4646
public function __construct(bool $debug)
4747
{
48-
$this->debug = $debug;
48+
$this->debug = $debug;
4949
}
5050

5151
/**
@@ -61,7 +61,9 @@ public function getConfigTreeBuilder(): TreeBuilder
6161
$children->booleanNode('enable_cache')->defaultValue(!$this->debug)->end();
6262
$children
6363
->scalarNode('cache_dir')
64-
->defaultValue('%metamodels.cache_dir%' . DIRECTORY_SEPARATOR . 'attribute_file');
64+
->defaultValue('%metamodels.cache_dir%' . DIRECTORY_SEPARATOR . 'attribute_file')
65+
->end();
66+
$children->booleanNode('file_usage')->defaultValue(false)->end();
6567

6668
return $treeBuilder;
6769
}

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 <c.schiffler@cyberspectrum.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_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) && (bool) ($config['file_usage'] ?? false)) {
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)