Skip to content

Commit d8b6e12

Browse files
authored
Merge pull request #6893 from magento-trigger/MC-42276
[Trigger] Performance optimizations and bug fixes
2 parents b4efd17 + de19806 commit d8b6e12

File tree

20 files changed

+548
-33
lines changed

20 files changed

+548
-33
lines changed

app/code/Magento/Cms/etc/adminhtml/di.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,9 @@
5757
<argument name="path" xsi:type="string">web/default_layouts/default_cms_layout</argument>
5858
</arguments>
5959
</virtualType>
60+
<type name="Magento\Cms\Model\Wysiwyg\Config">
61+
<arguments>
62+
<argument name="variableConfig" xsi:type="object">Magento\Variable\Model\Variable\Config\Proxy</argument>
63+
</arguments>
64+
</type>
6065
</config>
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Config\Model\Config;
10+
11+
use Magento\Framework\ObjectManager\NoninterceptableInterface;
12+
13+
/**
14+
* @inheritdoc
15+
*/
16+
class StructureLazy extends Structure implements NoninterceptableInterface
17+
{
18+
/**
19+
* @var Structure\Data
20+
*/
21+
private $structureData;
22+
23+
/**
24+
* @param \Magento\Config\Model\Config\Structure\Data $structureData
25+
* @param \Magento\Config\Model\Config\Structure\Element\Iterator\Tab $tabIterator
26+
* @param \Magento\Config\Model\Config\Structure\Element\FlyweightFactory $flyweightFactory
27+
* @param ScopeDefiner $scopeDefiner
28+
*/
29+
public function __construct(
30+
\Magento\Config\Model\Config\Structure\Data $structureData,
31+
\Magento\Config\Model\Config\Structure\Element\Iterator\Tab $tabIterator,
32+
\Magento\Config\Model\Config\Structure\Element\FlyweightFactory $flyweightFactory,
33+
ScopeDefiner $scopeDefiner
34+
) {
35+
$this->_tabIterator = $tabIterator;
36+
$this->_flyweightFactory = $flyweightFactory;
37+
$this->_scopeDefiner = $scopeDefiner;
38+
$this->structureData = $structureData;
39+
}
40+
41+
/**
42+
* @inheritdoc
43+
*/
44+
public function getElement($path)
45+
{
46+
$this->loadStructureData();
47+
return parent::getElement($path);
48+
}
49+
50+
/**
51+
* @inheritdoc
52+
*/
53+
public function getTabs()
54+
{
55+
$this->loadStructureData();
56+
return parent::getTabs();
57+
}
58+
59+
/**
60+
* @inheritdoc
61+
*/
62+
public function getSectionList()
63+
{
64+
$this->loadStructureData();
65+
return parent::getSectionList();
66+
}
67+
68+
/**
69+
* @inheritdoc
70+
*/
71+
public function getElementByConfigPath($path)
72+
{
73+
$this->loadStructureData();
74+
return parent::getElementByConfigPath($path);
75+
}
76+
77+
/**
78+
* @inheritdoc
79+
*/
80+
public function getFirstSection()
81+
{
82+
$this->loadStructureData();
83+
return parent::getTabs();
84+
}
85+
86+
/**
87+
* @inheritdoc
88+
*/
89+
public function getElementByPathParts(array $pathParts)
90+
{
91+
$this->loadStructureData();
92+
return parent:: getElementByPathParts($pathParts);
93+
}
94+
95+
/**
96+
* @inheritdoc
97+
*/
98+
public function getFieldPathsByAttribute($attributeName, $attributeValue)
99+
{
100+
$this->loadStructureData();
101+
return parent::getFieldPathsByAttribute($attributeName, $attributeValue);
102+
}
103+
104+
/**
105+
* @inheritdoc
106+
*/
107+
public function getFieldPaths()
108+
{
109+
$this->loadStructureData();
110+
return parent::getFieldPaths();
111+
}
112+
113+
/**
114+
* Load data
115+
*/
116+
private function loadStructureData()
117+
{
118+
if ($this->_data === null) {
119+
$this->_data = $this->structureData->get();
120+
}
121+
}
122+
}

app/code/Magento/Config/etc/di.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,4 +365,9 @@
365365
<argument name="structure" xsi:type="object">adminhtmlConfigStructure</argument>
366366
</arguments>
367367
</type>
368+
<type name="Magento\Config\Model\Config">
369+
<arguments>
370+
<argument name="configStructure" xsi:type="object">\Magento\Config\Model\Config\Structure\Proxy</argument>
371+
</arguments>
372+
</type>
368373
</config>

app/code/Magento/Email/Model/Template/Filter.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ class Filter extends Template
201201
*/
202202
private $pubDirectoryRead;
203203

204-
205204
/**
206205
* Filter constructor.
207206
* @param StringUtils $string
@@ -851,7 +850,7 @@ private function isAvailableConfigVariable($variable)
851850
{
852851
return in_array(
853852
$variable,
854-
array_column($this->configVariables->getData(), 'value')
853+
$this->configVariables->getAvailableVars()
855854
);
856855
}
857856

@@ -912,7 +911,7 @@ public function cssDirective($construction)
912911
return '/*' . PHP_EOL . $exception->getMessage() . PHP_EOL . '*/';
913912
}
914913

915-
if (empty($css)){
914+
if (empty($css)) {
916915
return '/* ' . __('Contents of the specified CSS file could not be loaded or is empty') . ' */';
917916
}
918917

app/code/Magento/Email/Test/Unit/Model/Template/FilterTest.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,6 @@ class FilterTest extends TestCase
138138
*/
139139
private $variableResolver;
140140

141-
/**
142-
* @var MockObject|VariableResolverInterface
143-
*/
144-
private $variableResolverInterface;
145-
146141
/**
147142
* @var array
148143
*/
@@ -417,7 +412,7 @@ public function testApplyInlineCssThrowsExceptionWhenDesignParamsNotSet()
417412
public function testConfigDirectiveAvailable()
418413
{
419414
$path = "web/unsecure/base_url";
420-
$availableConfigs = [['value' => $path]];
415+
$availableConfigs = ['value' => $path];
421416
$construction = ["{{config path={$path}}}", 'config', " path={$path}"];
422417
$scopeConfigValue = 'value';
423418

@@ -429,7 +424,7 @@ public function testConfigDirectiveAvailable()
429424
$storeMock->expects($this->once())->method('getId')->willReturn(1);
430425

431426
$this->configVariables->expects($this->once())
432-
->method('getData')
427+
->method('getAvailableVars')
433428
->willReturn($availableConfigs);
434429
$this->scopeConfig->expects($this->once())
435430
->method('getValue')
@@ -452,7 +447,7 @@ public function testConfigDirectiveUnavailable()
452447
$storeMock->expects($this->once())->method('getId')->willReturn(1);
453448

454449
$this->configVariables->expects($this->once())
455-
->method('getData')
450+
->method('getAvailableVars')
456451
->willReturn($availableConfigs);
457452
$this->scopeConfig->expects($this->never())
458453
->method('getValue')

app/code/Magento/Paypal/Block/PayLater/LayoutProcessor.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ public function process($jsLayout)
4949
{
5050
if (!$this->payLaterConfig->isEnabled(PayLaterConfig::CHECKOUT_PAYMENT_PLACEMENT)) {
5151
unset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']
52-
['children']['payment']['children']['payments-list']['children']['before-place-order']['children']
52+
['children']['payment']['children']['payments-list']['children']['paypal-method-extra-content']['children']
5353
['paylater-place-order']);
5454

5555
return $jsLayout;
5656
}
5757

5858
if (isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']
59-
['children']['payment']['children']['payments-list']['children']['before-place-order']['children']
59+
['children']['payment']['children']['payments-list']['children']['paypal-method-extra-content']['children']
6060
['paylater-place-order'])
6161
) {
6262
$payLaterPlaceOrder = &$jsLayout['components']['checkout']['children']['steps']['children']['billing-step']
63-
['children']['payment']['children']['payments-list']['children']['before-place-order']['children']
63+
['children']['payment']['children']['payments-list']['children']['paypal-method-extra-content']['children']
6464
['paylater-place-order'];
6565

6666
$componentConfig = $payLaterPlaceOrder['config'] ?? [];

app/code/Magento/Paypal/etc/adminhtml/di.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
<argument name="storage" xsi:type="object">Magento\Paypal\Model\PayflowSession\Storage</argument>
2727
</arguments>
2828
</virtualType>
29+
<type name="Magento\Paypal\Model\Config\StructurePlugin">
30+
<arguments>
31+
<argument xsi:type="object" name="backendHelper">Magento\Paypal\Helper\Backend\Proxy</argument>
32+
</arguments>
33+
</type>
2934
<type name="Magento\Config\Model\Config\Structure">
3035
<plugin name="paypal_system_configuration" type="Magento\Paypal\Model\Config\StructurePlugin"/>
3136
</type>

app/code/Magento/Paypal/view/frontend/layout/checkout_index_index.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@
2525
<item name="children" xsi:type="array">
2626
<item name="payments-list" xsi:type="array">
2727
<item name="children" xsi:type="array">
28-
<item name="before-place-order" xsi:type="array">
28+
<item name="paypal-method-extra-content" xsi:type="array">
29+
<item name="component" xsi:type="string">uiComponent</item>
30+
<item name="displayArea" xsi:type="string">paypal-method-extra-content</item>
2931
<item name="children" xsi:type="array">
3032
<item name="paylater-place-order" xsi:type="array">
3133
<item name="component" xsi:type="string">Magento_Paypal/js/view/paylater</item>
32-
<item name="sortOrder" xsi:type="string">100</item>
33-
<item name="displayArea" xsi:type="string">before-place-order</item>
34+
<item name="displayArea" xsi:type="string">paypal-method-extra-content</item>
3435
</item>
3536
</item>
3637
</item>

app/code/Magento/Paypal/view/frontend/web/template/payment/payflow-express-bml.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
<!-- ko template: getTemplate() --><!-- /ko -->
3939
<!--/ko-->
4040
</div>
41+
<div class="payment-method-extra-content">
42+
<each args="$parent.getRegion('paypal-method-extra-content')" render=""/>
43+
</div>
4144
<div class="actions-toolbar">
4245
<div class="primary">
4346
<button class="action primary checkout"

app/code/Magento/Paypal/view/frontend/web/template/payment/payflow-express.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
<!-- ko template: getTemplate() --><!-- /ko -->
3636
<!--/ko-->
3737
</div>
38+
<div class="payment-method-extra-content">
39+
<each args="$parent.getRegion('paypal-method-extra-content')" render=""/>
40+
</div>
3841
<div class="actions-toolbar">
3942
<div class="primary">
4043
<button class="action primary checkout"

0 commit comments

Comments
 (0)