Skip to content

Commit b169e62

Browse files
Merge pull request #4907 from magento-engcom/2.3-develop-express-lane-prs
[Magento Community Engineering] Community Contributions - 2.3-develop daily delivery
2 parents 8ec15ae + 950c679 commit b169e62

File tree

29 files changed

+581
-165
lines changed

29 files changed

+581
-165
lines changed

Diff for: app/code/Magento/Catalog/Helper/Output.php

+34-18
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,21 @@
99

1010
use Magento\Catalog\Model\Category as ModelCategory;
1111
use Magento\Catalog\Model\Product as ModelProduct;
12+
use Magento\Eav\Model\Config;
13+
use Magento\Framework\App\Helper\AbstractHelper;
14+
use Magento\Framework\App\Helper\Context;
15+
use Magento\Framework\Escaper;
16+
use Magento\Framework\Exception\LocalizedException;
1217
use Magento\Framework\Filter\Template;
18+
use function is_object;
19+
use function method_exists;
20+
use function preg_match;
21+
use function strtolower;
1322

14-
class Output extends \Magento\Framework\App\Helper\AbstractHelper
23+
/**
24+
* Html output
25+
*/
26+
class Output extends AbstractHelper
1527
{
1628
/**
1729
* Array of existing handlers
@@ -37,12 +49,12 @@ class Output extends \Magento\Framework\App\Helper\AbstractHelper
3749
/**
3850
* Eav config
3951
*
40-
* @var \Magento\Eav\Model\Config
52+
* @var Config
4153
*/
4254
protected $_eavConfig;
4355

4456
/**
45-
* @var \Magento\Framework\Escaper
57+
* @var Escaper
4658
*/
4759
protected $_escaper;
4860

@@ -53,27 +65,32 @@ class Output extends \Magento\Framework\App\Helper\AbstractHelper
5365

5466
/**
5567
* Output constructor.
56-
* @param \Magento\Framework\App\Helper\Context $context
57-
* @param \Magento\Eav\Model\Config $eavConfig
68+
* @param Context $context
69+
* @param Config $eavConfig
5870
* @param Data $catalogData
59-
* @param \Magento\Framework\Escaper $escaper
71+
* @param Escaper $escaper
6072
* @param array $directivePatterns
73+
* @param array $handlers
6174
*/
6275
public function __construct(
63-
\Magento\Framework\App\Helper\Context $context,
64-
\Magento\Eav\Model\Config $eavConfig,
76+
Context $context,
77+
Config $eavConfig,
6578
Data $catalogData,
66-
\Magento\Framework\Escaper $escaper,
67-
$directivePatterns = []
79+
Escaper $escaper,
80+
$directivePatterns = [],
81+
array $handlers = []
6882
) {
6983
$this->_eavConfig = $eavConfig;
7084
$this->_catalogData = $catalogData;
7185
$this->_escaper = $escaper;
7286
$this->directivePatterns = $directivePatterns;
87+
$this->_handlers = $handlers;
7388
parent::__construct($context);
7489
}
7590

7691
/**
92+
* Return template processor
93+
*
7794
* @return Template
7895
*/
7996
protected function _getTemplateProcessor()
@@ -115,8 +132,7 @@ public function addHandler($method, $handler)
115132
*/
116133
public function getHandlers($method)
117134
{
118-
$method = strtolower($method);
119-
return $this->_handlers[$method] ?? [];
135+
return $this->_handlers[strtolower($method)] ?? [];
120136
}
121137

122138
/**
@@ -145,21 +161,21 @@ public function process($method, $result, $params)
145161
* @param string $attributeName
146162
* @return string
147163
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
148-
* @throws \Magento\Framework\Exception\LocalizedException
164+
* @throws LocalizedException
149165
*/
150166
public function productAttribute($product, $attributeHtml, $attributeName)
151167
{
152168
$attribute = $this->_eavConfig->getAttribute(ModelProduct::ENTITY, $attributeName);
153169
if ($attribute &&
154170
$attribute->getId() &&
155-
$attribute->getFrontendInput() != 'media_image' &&
171+
$attribute->getFrontendInput() !== 'media_image' &&
156172
(!$attribute->getIsHtmlAllowedOnFront() &&
157173
!$attribute->getIsWysiwygEnabled())
158174
) {
159-
if ($attribute->getFrontendInput() != 'price') {
175+
if ($attribute->getFrontendInput() !== 'price') {
160176
$attributeHtml = $this->_escaper->escapeHtml($attributeHtml);
161177
}
162-
if ($attribute->getFrontendInput() == 'textarea') {
178+
if ($attribute->getFrontendInput() === 'textarea') {
163179
$attributeHtml = nl2br($attributeHtml);
164180
}
165181
}
@@ -187,14 +203,14 @@ public function productAttribute($product, $attributeHtml, $attributeName)
187203
* @param string $attributeHtml
188204
* @param string $attributeName
189205
* @return string
190-
* @throws \Magento\Framework\Exception\LocalizedException
206+
* @throws LocalizedException
191207
*/
192208
public function categoryAttribute($category, $attributeHtml, $attributeName)
193209
{
194210
$attribute = $this->_eavConfig->getAttribute(ModelCategory::ENTITY, $attributeName);
195211

196212
if ($attribute &&
197-
$attribute->getFrontendInput() != 'image' &&
213+
$attribute->getFrontendInput() !== 'image' &&
198214
(!$attribute->getIsHtmlAllowedOnFront() &&
199215
!$attribute->getIsWysiwygEnabled())
200216
) {

Diff for: app/code/Magento/Directory/etc/adminhtml/system.xml

+18
Original file line numberDiff line numberDiff line change
@@ -67,27 +67,45 @@
6767
<field id="error_email" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
6868
<label>Error Email Recipient</label>
6969
<validate>validate-email</validate>
70+
<depends>
71+
<field id="enabled">1</field>
72+
</depends>
7073
</field>
7174
<field id="error_email_identity" translate="label" type="select" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
7275
<label>Error Email Sender</label>
7376
<source_model>Magento\Config\Model\Config\Source\Email\Identity</source_model>
77+
<depends>
78+
<field id="enabled">1</field>
79+
</depends>
7480
</field>
7581
<field id="error_email_template" translate="label comment" type="select" sortOrder="7" showInDefault="1" showInWebsite="1" showInStore="0" canRestore="1">
7682
<label>Error Email Template</label>
7783
<comment>Email template chosen based on theme fallback when "Default" option is selected.</comment>
7884
<source_model>Magento\Config\Model\Config\Source\Email\Template</source_model>
85+
<depends>
86+
<field id="enabled">1</field>
87+
</depends>
7988
</field>
8089
<field id="frequency" translate="label" type="select" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1">
8190
<label>Frequency</label>
8291
<source_model>Magento\Cron\Model\Config\Source\Frequency</source_model>
92+
<depends>
93+
<field id="enabled">1</field>
94+
</depends>
8395
</field>
8496
<field id="service" translate="label" type="select" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
8597
<label>Service</label>
8698
<source_model>Magento\Directory\Model\Currency\Import\Source\Service</source_model>
8799
<backend_model>Magento\Config\Model\Config\Backend\Currency\Cron</backend_model>
100+
<depends>
101+
<field id="enabled">1</field>
102+
</depends>
88103
</field>
89104
<field id="time" translate="label" type="time" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1">
90105
<label>Start Time</label>
106+
<depends>
107+
<field id="enabled">1</field>
108+
</depends>
91109
</field>
92110
</group>
93111
</section>

Diff for: app/code/Magento/Elasticsearch/etc/di.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@
267267
</type>
268268
<virtualType name="Magento\Elasticsearch\Elasticsearch5\SearchAdapter\ConnectionManager" type="Magento\Elasticsearch\SearchAdapter\ConnectionManager">
269269
<arguments>
270-
<argument name="clientFactory" xsi:type="object">Magento\Elasticsearch\Elasticsearch5\Model\Client\ElasticsearchFactory</argument>
270+
<argument name="clientFactory" xsi:type="object">Magento\Elasticsearch\Elasticsearch5\Model\Client\ClientFactoryProxy</argument>
271271
<argument name="clientConfig" xsi:type="object">Magento\Elasticsearch\Model\Config</argument>
272272
</arguments>
273273
</virtualType>

Diff for: app/code/Magento/Sales/Model/Order/Email/Container/CreditmemoCommentIdentity.php

+21-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Sales\Model\Order\Email\Container;
79

10+
/**
11+
* Class \Magento\Sales\Model\Order\Email\Container\CreditmemoCommentIdentity
12+
*/
813
class CreditmemoCommentIdentity extends Container implements IdentityInterface
914
{
15+
/**
16+
* Configuration paths
17+
*/
1018
const XML_PATH_EMAIL_COPY_METHOD = 'sales_email/creditmemo_comment/copy_method';
1119
const XML_PATH_EMAIL_COPY_TO = 'sales_email/creditmemo_comment/copy_to';
1220
const XML_PATH_EMAIL_IDENTITY = 'sales_email/creditmemo_comment/identity';
@@ -15,6 +23,8 @@ class CreditmemoCommentIdentity extends Container implements IdentityInterface
1523
const XML_PATH_EMAIL_ENABLED = 'sales_email/creditmemo_comment/enabled';
1624

1725
/**
26+
* Is email enabled
27+
*
1828
* @return bool
1929
*/
2030
public function isEnabled()
@@ -27,18 +37,22 @@ public function isEnabled()
2737
}
2838

2939
/**
40+
* Return email copy_to list
41+
*
3042
* @return array|bool
3143
*/
3244
public function getEmailCopyTo()
3345
{
3446
$data = $this->getConfigValue(self::XML_PATH_EMAIL_COPY_TO, $this->getStore()->getStoreId());
3547
if (!empty($data)) {
36-
return explode(',', $data);
48+
return array_map('trim', explode(',', $data));
3749
}
3850
return false;
3951
}
4052

4153
/**
54+
* Return email copy method
55+
*
4256
* @return mixed
4357
*/
4458
public function getCopyMethod()
@@ -47,6 +61,8 @@ public function getCopyMethod()
4761
}
4862

4963
/**
64+
* Return guest template id
65+
*
5066
* @return mixed
5167
*/
5268
public function getGuestTemplateId()
@@ -55,6 +71,8 @@ public function getGuestTemplateId()
5571
}
5672

5773
/**
74+
* Return template id
75+
*
5876
* @return mixed
5977
*/
6078
public function getTemplateId()
@@ -63,6 +81,8 @@ public function getTemplateId()
6381
}
6482

6583
/**
84+
* Return email identity
85+
*
6686
* @return mixed
6787
*/
6888
public function getEmailIdentity()

Diff for: app/code/Magento/Sales/Model/Order/Email/Container/CreditmemoIdentity.php

+21-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Sales\Model\Order\Email\Container;
79

10+
/**
11+
* Class \Magento\Sales\Model\Order\Email\Container\CreditmemoIdentity
12+
*/
813
class CreditmemoIdentity extends Container implements IdentityInterface
914
{
15+
/**
16+
* Configuration paths
17+
*/
1018
const XML_PATH_EMAIL_COPY_METHOD = 'sales_email/creditmemo/copy_method';
1119
const XML_PATH_EMAIL_COPY_TO = 'sales_email/creditmemo/copy_to';
1220
const XML_PATH_EMAIL_IDENTITY = 'sales_email/creditmemo/identity';
@@ -15,6 +23,8 @@ class CreditmemoIdentity extends Container implements IdentityInterface
1523
const XML_PATH_EMAIL_ENABLED = 'sales_email/creditmemo/enabled';
1624

1725
/**
26+
* Is email enabled
27+
*
1828
* @return bool
1929
*/
2030
public function isEnabled()
@@ -27,18 +37,22 @@ public function isEnabled()
2737
}
2838

2939
/**
40+
* Return email copy_to list
41+
*
3042
* @return array|bool
3143
*/
3244
public function getEmailCopyTo()
3345
{
3446
$data = $this->getConfigValue(self::XML_PATH_EMAIL_COPY_TO, $this->getStore()->getStoreId());
3547
if (!empty($data)) {
36-
return explode(',', $data);
48+
return array_map('trim', explode(',', $data));
3749
}
3850
return false;
3951
}
4052

4153
/**
54+
* Return email copy method
55+
*
4256
* @return mixed
4357
*/
4458
public function getCopyMethod()
@@ -47,6 +61,8 @@ public function getCopyMethod()
4761
}
4862

4963
/**
64+
* Return guest template id
65+
*
5066
* @return mixed
5167
*/
5268
public function getGuestTemplateId()
@@ -55,6 +71,8 @@ public function getGuestTemplateId()
5571
}
5672

5773
/**
74+
* Return template id
75+
*
5876
* @return mixed
5977
*/
6078
public function getTemplateId()
@@ -63,6 +81,8 @@ public function getTemplateId()
6381
}
6482

6583
/**
84+
* Return email identity
85+
*
6686
* @return mixed
6787
*/
6888
public function getEmailIdentity()

0 commit comments

Comments
 (0)