forked from ConvertGroupsAS/magento2-patches
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Patch-Magento_Email-M2.1.0-create-email-logo-1.patch
60 lines (58 loc) · 2.06 KB
/
Patch-Magento_Email-M2.1.0-create-email-logo-1.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
--- Model/AbstractTemplate.php
+++ Model/AbstractTemplate.php
@@ -389,7 +389,7 @@ abstract class AbstractTemplate extends AbstractModel implements TemplateTypesIn
$store
);
if ($fileName) {
- $uploadDir = \Magento\Config\Model\Config\Backend\Email\Logo::UPLOAD_DIR;
+ $uploadDir = \Magento\Email\Model\Design\Backend\Logo::UPLOAD_DIR;
$mediaDirectory = $this->filesystem->getDirectoryRead(DirectoryList::MEDIA);
if ($mediaDirectory->isFile($uploadDir . '/' . $fileName)) {
return $this->storeManager->getStore()->getBaseUrl(
--- /dev/null
+++ Model/Design/Backend/Logo.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Copyright © 2016 Magento. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+namespace Magento\Email\Model\Design\Backend;
+
+use Magento\Theme\Model\Design\Backend\Logo as DesignLogo;
+
+class Logo extends DesignLogo
+{
+ /**
+ * The tail part of directory path for uploading
+ */
+ const UPLOAD_DIR = 'email/logo';
+
+ /**
+ * Upload max file size in kilobytes
+ *
+ * @var int
+ */
+ protected $maxFileSize = 2048;
+
+ /**
+ * Getter for allowed extensions of uploaded files
+ *
+ * @return string[]
+ */
+ public function getAllowedExtensions()
+ {
+ return ['jpg', 'jpeg', 'gif', 'png'];
+ }
+}
--- etc/di.xml
+++ etc/di.xml
@@ -27,7 +27,7 @@
<item name="email_logo" xsi:type="array">
<item name="path" xsi:type="string">design/email/logo</item>
<item name="fieldset" xsi:type="string">other_settings/email</item>
- <item name="backend_model" xsi:type="string">Magento\Theme\Model\Design\Backend\Logo</item>
+ <item name="backend_model" xsi:type="string">Magento\Email\Model\Design\Backend\Logo</item>
<item name="base_url" xsi:type="array">
<item name="type" xsi:type="string">media</item>
<item name="scope_info" xsi:type="string">1</item>