12
12
class EmailDataFactory
13
13
{
14
14
/**
15
- * @var ConfigResolverInterface
15
+ * @var array
16
16
*/
17
- protected $ configResolver ;
17
+ protected $ config ;
18
18
19
19
/**
20
20
* @var TranslationHelper
@@ -34,19 +34,19 @@ class EmailDataFactory
34
34
/**
35
35
* EmailDataFactory constructor.
36
36
*
37
- * @param ConfigResolverInterface $configResolver
37
+ * @param array $config
38
38
* @param TranslationHelper $translationHelper
39
39
* @param FieldHelper $fieldHelper
40
40
* @param ContentTypeService $contentTypeService
41
41
*/
42
42
public function __construct (
43
- ConfigResolverInterface $ configResolver ,
43
+ array $ config ,
44
44
TranslationHelper $ translationHelper ,
45
45
FieldHelper $ fieldHelper ,
46
46
ContentTypeService $ contentTypeService
47
47
) {
48
48
49
- $ this ->configResolver = $ configResolver ;
49
+ $ this ->config = $ config ;
50
50
$ this ->translationHelper = $ translationHelper ;
51
51
$ this ->fieldHelper = $ fieldHelper ;
52
52
$ this ->contentTypeService = $ contentTypeService ;
@@ -87,7 +87,7 @@ protected function resolve(Content $content, $field, $property = 'text')
87
87
88
88
return $ fieldValue ->value ->$ property ;
89
89
} else {
90
- return $ this ->configResolver -> getParameter ( ' information_collection.email. ' . $ field, ' netgen ' ) ;
90
+ return $ this ->config [ ' default_variables ' ][ $ field] ;
91
91
}
92
92
}
93
93
@@ -104,10 +104,12 @@ protected function resolveTemplate($content)
104
104
105
105
$ contentTypeIdentifier = $ contentType ->identifier ;
106
106
107
- if ($ this ->configResolver ->hasParameter ('information_collection.email. ' . $ contentTypeIdentifier , 'netgen ' )) {
108
- return $ this ->configResolver ->getParameter ('information_collection.email. ' . $ contentTypeIdentifier , 'netgen ' );
107
+ if (array_key_exists ($ contentTypeIdentifier , $ this ->config ['templates ' ])) {
108
+
109
+ return $ this ->config ['templates ' ][$ contentTypeIdentifier ];
110
+
109
111
}
110
112
111
- return $ this ->configResolver -> getParameter ( ' information_collection.email.default ' , ' netgen ' ) ;
113
+ return $ this ->config [ ' templates ' ][ ' default ' ] ;
112
114
}
113
115
}
0 commit comments