This repository was archived by the owner on Feb 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +53
-1
lines changed Expand file tree Collapse file tree 4 files changed +53
-1
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Mageplaza
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Mageplaza.com license that is
8
+ * available through the world-wide-web at this URL:
9
+ * https://www.mageplaza.com/LICENSE.txt
10
+ *
11
+ * DISCLAIMER
12
+ *
13
+ * Do not edit or add to this file if you wish to upgrade this extension to newer
14
+ * version in the future.
15
+ *
16
+ * @category Mageplaza
17
+ * @package Mageplaza_EmailAttachments
18
+ * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/)
19
+ * @license https://www.mageplaza.com/LICENSE.txt
20
+ */
21
+
22
+ namespace Mageplaza \EmailAttachments \Model \Config \Backend ;
23
+
24
+ use Magento \Framework \App \Config \Value ;
25
+ use Magento \Framework \Exception \ValidatorException ;
26
+
27
+ /**
28
+ * Class Email
29
+ * @package Mageplaza\EmailAttachments\Model\Config\Backend
30
+ */
31
+ class Email extends Value
32
+ {
33
+ /**
34
+ * @return Value|void
35
+ * @throws ValidatorException
36
+ */
37
+ public function beforeSave ()
38
+ {
39
+ if (!empty ($ this ->getValue ())) {
40
+ $ valueArray = explode (', ' , $ this ->getValue ());
41
+ foreach ($ valueArray as $ value ) {
42
+ if (!filter_var ($ value , FILTER_VALIDATE_EMAIL )) {
43
+ throw new ValidatorException (__ ('Invalid email format. ' ));
44
+ }
45
+ }
46
+ }
47
+ parent ::beforeSave (); // TODO: Change the autogenerated stub
48
+ }
49
+ }
Original file line number Diff line number Diff line change 5
5
"mageplaza/module-core" : " ^1.4.5"
6
6
},
7
7
"type" : " magento2-module" ,
8
- "version" : " 1.0.4 " ,
8
+ "version" : " 1.0.5 " ,
9
9
"license" : " proprietary" ,
10
10
"authors" : [
11
11
{
Original file line number Diff line number Diff line change 35
35
</field >
36
36
<field id =" cc_to" translate =" label comment" type =" text" sortOrder =" 20" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
37
37
<label >CC to Emails</label >
38
+ <backend_model >Mageplaza\EmailAttachments\Model\Config\Backend\Email</backend_model >
38
39
<comment >Comma-separated</comment >
39
40
</field >
40
41
<field id =" bcc_to" translate =" label comment" type =" text" sortOrder =" 30" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" >
41
42
<label >BCC to Emails</label >
43
+ <backend_model >Mageplaza\EmailAttachments\Model\Config\Backend\Email</backend_model >
42
44
<comment >Comma-separated</comment >
43
45
</field >
44
46
<field id =" is_enabled_attach_pdf" translate =" label" sortOrder =" 40" type =" select" showInDefault =" 1" showInWebsite =" 1" showInStore =" 1" canRestore =" 1" >
Original file line number Diff line number Diff line change
1
+ "Invalid email format.","Invalid email format."
1
2
Invoice,Invoice
2
3
Shipment,Shipment
3
4
"Credit Memo","Credit Memo"
You can’t perform that action at this time.
0 commit comments