Skip to content

Commit 389c11a

Browse files
committed
Apply Repository forms support only if Repository form bundle is installed
1 parent 81ea854 commit 389c11a

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

bundle/DependencyInjection/NetgenEnhancedBinaryFileExtension.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ class NetgenEnhancedBinaryFileExtension extends Extension implements PrependExte
2020
*/
2121
public function prepend(ContainerBuilder $container)
2222
{
23-
$fileName = 'ez_field_templates.yml';
24-
$configFile = __DIR__ . '/../Resources/config/' . $fileName;
25-
$config = Yaml::parse(file_get_contents($configFile));
23+
if (class_exists(\EzSystems\RepositoryFormsBundle\EzSystemsRepositoryFormsBundle::class)) {
24+
$fileName = 'ez_field_templates.yml';
25+
$configFile = __DIR__ . '/../Resources/config/' . $fileName;
26+
$config = Yaml::parse(file_get_contents($configFile));
2627

27-
$container->prependExtensionConfig('ezpublish', $config);
28-
$container->addResource(new FileResource($configFile));
28+
$container->prependExtensionConfig('ezpublish', $config);
29+
$container->addResource(new FileResource($configFile));
30+
}
2931
}
3032

3133
/**
@@ -42,6 +44,10 @@ public function load(array $configs, ContainerBuilder $container)
4244
} else {
4345
$loader->load('fieldtypes_before_611.yml');
4446
}
47+
48+
if (class_exists(\EzSystems\RepositoryFormsBundle\EzSystemsRepositoryFormsBundle::class)) {
49+
$loader->load('repository_forms.yml');
50+
}
4551
$loader->load('fieldtypes.yml');
4652
$loader->load('field_type_handlers.yml');
4753
$loader->load('storage_engines.yml');

bundle/Resources/config/fieldtypes.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,3 @@ services:
1212
class: eZ\Publish\Core\FieldType\BinaryFile\BinaryFileStorage\Gateway\LegacyStorage
1313
tags:
1414
- { name: ezpublish.fieldType.externalStorageHandler.gateway, alias: enhancedezbinaryfile, identifier: LegacyStorage }
15-
16-
ezpublish.fieldType.enhancedezbinaryfile.form_mapper:
17-
class: Netgen\Bundle\EnhancedBinaryFileBundle\Core\FieldType\EnhancedBinaryFile\FormMapper
18-
arguments:
19-
- "@ezpublish.api.service.field_type"
20-
- "@ezrepoforms.config_resolver.max_upload_size"
21-
tags:
22-
- { name: ez.fieldFormMapper.definition, fieldType: enhancedezbinaryfile }
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
services:
2+
ezpublish.fieldType.enhancedezbinaryfile.form_mapper:
3+
class: Netgen\Bundle\EnhancedBinaryFileBundle\Core\FieldType\EnhancedBinaryFile\FormMapper
4+
arguments:
5+
- "@ezpublish.api.service.field_type"
6+
- "@ezrepoforms.config_resolver.max_upload_size"
7+
tags:
8+
- { name: ez.fieldFormMapper.definition, fieldType: enhancedezbinaryfile }

0 commit comments

Comments
 (0)