Skip to content

Commit feb1c5a

Browse files
author
Oleksii Korshenko
authored
Merge pull request #1440 from magento-engcom/develop-prs
Public Pull Requests #10668 #10667 #10655 #10651 #10648 #10640 #10608
2 parents b2f688c + 1fda0a6 commit feb1c5a

File tree

14 files changed

+132
-32
lines changed

14 files changed

+132
-32
lines changed

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,22 @@
115115
<label>Enabled Template Path Hints for Storefront</label>
116116
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
117117
</field>
118+
<field id="template_hints_storefront_show_with_parameter" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
119+
<label>Enable Hints for Storefront with URL Parameter</label>
120+
<depends>
121+
<field id="*/*/template_hints_storefront">1</field>
122+
</depends>
123+
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
124+
<comment>Use URL parameter to enable template path hints for Storefront</comment>
125+
</field>
126+
<field id="template_hints_parameter_value" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
127+
<label>Parameter Value</label>
128+
<depends>
129+
<field id="*/*/template_hints_storefront">1</field>
130+
<field id="*/*/template_hints_storefront_show_with_parameter">1</field>
131+
</depends>
132+
<comment>Add the following paramater to the URL to show template hints ?templatehints=[parameter_value]</comment>
133+
</field>
118134
<field id="template_hints_admin" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
119135
<label>Enabled Template Path Hints for Admin</label>
120136
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>

app/code/Magento/Developer/Model/TemplateEngine/Plugin/DebugHints.php

Lines changed: 59 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Magento\Framework\View\TemplateEngineInterface;
1515
use Magento\Store\Model\ScopeInterface;
1616
use Magento\Store\Model\StoreManagerInterface;
17+
use Magento\Framework\App\Request\Http;
1718

1819
class DebugHints
1920
{
@@ -53,25 +54,54 @@ class DebugHints
5354
*/
5455
protected $debugHintsPath;
5556

57+
/**
58+
* XPath of configuration of the debug hints show with parameter
59+
*
60+
* dev/debug/template_hints_storefront_show_with_parameter
61+
*
62+
* @var string
63+
*/
64+
private $debugHintsWithParam;
65+
66+
/**
67+
* XPath of configuration of the debug hints URL parameter
68+
*
69+
* dev/debug/template_hints_parameter_value
70+
*
71+
* @var string
72+
*/
73+
private $debugHintsParameter;
74+
5675
/**
5776
* @param ScopeConfigInterface $scopeConfig
5877
* @param StoreManagerInterface $storeManager
5978
* @param DevHelper $devHelper
6079
* @param DebugHintsFactory $debugHintsFactory
6180
* @param string $debugHintsPath
81+
* @param Http $http
82+
* @param string $debugHintsWithParam
83+
* @param string $debugHintsParameter
6284
*/
6385
public function __construct(
6486
ScopeConfigInterface $scopeConfig,
6587
StoreManagerInterface $storeManager,
6688
DevHelper $devHelper,
6789
DebugHintsFactory $debugHintsFactory,
68-
$debugHintsPath
90+
$debugHintsPath,
91+
Http $http = null,
92+
$debugHintsWithParam = null,
93+
$debugHintsParameter = null
6994
) {
7095
$this->scopeConfig = $scopeConfig;
7196
$this->storeManager = $storeManager;
7297
$this->devHelper = $devHelper;
7398
$this->debugHintsFactory = $debugHintsFactory;
7499
$this->debugHintsPath = $debugHintsPath;
100+
$this->http = $http ?: \Magento\Framework\App\ObjectManager::getInstance()->get(
101+
\Magento\Framework\App\Request\Http::class
102+
);
103+
$this->debugHintsWithParam = $debugHintsWithParam;
104+
$this->debugHintsParameter = $debugHintsParameter;
75105
}
76106

77107
/**
@@ -90,15 +120,37 @@ public function afterCreate(
90120
$storeCode = $this->storeManager->getStore()->getCode();
91121
if ($this->scopeConfig->getValue($this->debugHintsPath, ScopeInterface::SCOPE_STORE, $storeCode)
92122
&& $this->devHelper->isDevAllowed()) {
93-
$showBlockHints = $this->scopeConfig->getValue(
94-
self::XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS,
123+
$debugHintsWithParam = $this->scopeConfig->getValue(
124+
$this->debugHintsWithParam,
125+
ScopeInterface::SCOPE_STORE,
126+
$storeCode
127+
);
128+
$debugHintsParameter = $this->scopeConfig->getValue(
129+
$this->debugHintsParameter,
95130
ScopeInterface::SCOPE_STORE,
96131
$storeCode
97132
);
98-
return $this->debugHintsFactory->create([
99-
'subject' => $invocationResult,
100-
'showBlockHints' => $showBlockHints,
101-
]);
133+
$debugHintsParameterInUrl = $this->http->getParam('templatehints');
134+
135+
$showHints = false;
136+
if (!$debugHintsWithParam) {
137+
$showHints = true;
138+
}
139+
if ($debugHintsWithParam && $debugHintsParameter == $debugHintsParameterInUrl) {
140+
$showHints = true;
141+
}
142+
143+
if ($showHints) {
144+
$showBlockHints = $this->scopeConfig->getValue(
145+
self::XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS,
146+
ScopeInterface::SCOPE_STORE,
147+
$storeCode
148+
);
149+
return $this->debugHintsFactory->create([
150+
'subject' => $invocationResult,
151+
'showBlockHints' => $showBlockHints,
152+
]);
153+
}
102154
}
103155
return $invocationResult;
104156
}

app/code/Magento/Developer/Test/Unit/Model/TemplateEngine/Plugin/DebugHintsTest.php

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@ protected function setUp()
6060
* @return void
6161
* @dataProvider afterCreateActiveDataProvider
6262
*/
63-
public function testAfterCreateActive($debugHintsPath, $showBlockHints)
64-
{
63+
public function testAfterCreateActive(
64+
$debugHintsPath,
65+
$showBlockHints,
66+
$debugHintsWithParam,
67+
$debugHintsParameter
68+
) {
6569
$this->devHelperMock->expects($this->once())
6670
->method('isDevAllowed')
6771
->willReturn(true);
@@ -88,12 +92,17 @@ public function testAfterCreateActive($debugHintsPath, $showBlockHints)
8892
->disableOriginalConstructor()
8993
->getMock();
9094

95+
$this->httpMock = $this->createMock(\Magento\Framework\App\Request\Http::class);
96+
9197
$debugHints = new DebugHints(
9298
$this->scopeConfigMock,
9399
$this->storeManager,
94100
$this->devHelperMock,
95101
$this->debugHintsFactory,
96-
$debugHintsPath
102+
$debugHintsPath,
103+
$this->httpMock,
104+
$debugHintsWithParam,
105+
$debugHintsParameter
97106
);
98107

99108
$this->assertEquals($debugHintsDecorator, $debugHints->afterCreate($subjectMock, $engine));
@@ -105,10 +114,10 @@ public function testAfterCreateActive($debugHintsPath, $showBlockHints)
105114
public function afterCreateActiveDataProvider()
106115
{
107116
return [
108-
['dev/debug/template_hints_storefront', false],
109-
['dev/debug/template_hints_storefront', true],
110-
['dev/debug/template_hints_admin', false],
111-
['dev/debug/template_hints_admin', true],
117+
['dev/debug/template_hints_storefront', false, false, null],
118+
['dev/debug/template_hints_storefront', true, false, null],
119+
['dev/debug/template_hints_admin', false, false, null],
120+
['dev/debug/template_hints_admin', true, false, null],
112121
];
113122
}
114123

@@ -119,8 +128,13 @@ public function afterCreateActiveDataProvider()
119128
* @return void
120129
* @dataProvider afterCreateInactiveDataProvider
121130
*/
122-
public function testAfterCreateInactive($debugHintsPath, $isDevAllowed, $showTemplateHints)
123-
{
131+
public function testAfterCreateInactive(
132+
$debugHintsPath,
133+
$isDevAllowed,
134+
$showTemplateHints,
135+
$debugHintsWithParam,
136+
$debugHintsParameter
137+
) {
124138
$this->devHelperMock->expects($this->any())
125139
->method('isDevAllowed')
126140
->willReturn($isDevAllowed);
@@ -133,12 +147,17 @@ public function testAfterCreateInactive($debugHintsPath, $isDevAllowed, $showTem
133147
->disableOriginalConstructor()
134148
->getMock();
135149

150+
$this->httpMock = $this->createMock(\Magento\Framework\App\Request\Http::class);
151+
136152
$debugHints = new DebugHints(
137153
$this->scopeConfigMock,
138154
$this->storeManager,
139155
$this->devHelperMock,
140156
$this->debugHintsFactory,
141-
$debugHintsPath
157+
$debugHintsPath,
158+
$this->httpMock,
159+
$debugHintsWithParam,
160+
$debugHintsParameter
142161
);
143162

144163
$this->assertSame($engine, $debugHints->afterCreate($subjectMock, $engine));
@@ -150,12 +169,12 @@ public function testAfterCreateInactive($debugHintsPath, $isDevAllowed, $showTem
150169
public function afterCreateInactiveDataProvider()
151170
{
152171
return [
153-
['dev/debug/template_hints_storefront', false, false],
154-
['dev/debug/template_hints_storefront', false, true],
155-
['dev/debug/template_hints_storefront', true, false],
156-
['dev/debug/template_hints_admin', false, false],
157-
['dev/debug/template_hints_admin', false, true],
158-
['dev/debug/template_hints_admin', true, false],
172+
['dev/debug/template_hints_storefront', false, false, false, null],
173+
['dev/debug/template_hints_storefront', false, true, false, null],
174+
['dev/debug/template_hints_storefront', true, false, false, null],
175+
['dev/debug/template_hints_admin', false, false, false, null],
176+
['dev/debug/template_hints_admin', false, true, false, null],
177+
['dev/debug/template_hints_admin', true, false, false, null],
159178
];
160179
}
161180

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
<type name="Magento\Developer\Model\TemplateEngine\Plugin\DebugHints">
1313
<arguments>
1414
<argument name="debugHintsPath" xsi:type="string">dev/debug/template_hints_admin</argument>
15+
<argument name="debugHintsWithParam" xsi:type="string">dev/debug/template_hints_storefront_show_with_parameter</argument>
16+
<argument name="debugHintsParameter" xsi:type="string">dev/debug/template_hints_parameter_value</argument>
1517
</arguments>
1618
</type>
1719
</config>

app/code/Magento/Developer/etc/config.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
99
<default>
1010
<dev>
11+
<debug>
12+
<template_hints_storefront_show_with_parameter>0</template_hints_storefront_show_with_parameter>
13+
<template_hints_parameter_value>magento</template_hints_parameter_value>
14+
</debug>
1115
<restrict>
1216
<allow_ips />
1317
</restrict>

app/code/Magento/Developer/etc/frontend/di.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
<type name="Magento\Developer\Model\TemplateEngine\Plugin\DebugHints">
1313
<arguments>
1414
<argument name="debugHintsPath" xsi:type="string">dev/debug/template_hints_storefront</argument>
15+
<argument name="debugHintsWithParam" xsi:type="string">dev/debug/template_hints_storefront_show_with_parameter</argument>
16+
<argument name="debugHintsParameter" xsi:type="string">dev/debug/template_hints_parameter_value</argument>
1517
</arguments>
1618
</type>
1719
</config>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
<argument name="countriesWithNotRequiredStates" xsi:type="array">
3838
<item name="FR" xsi:type="string">FR</item>
3939
<item name="DE" xsi:type="string">DE</item>
40+
<item name="AT" xsi:type="string">AT</item>
41+
<item name="FI" xsi:type="string">FI</item>
4042
</argument>
4143
</arguments>
4244
</type>

app/code/Magento/GroupedProduct/view/frontend/layout/catalog_product_view_type_grouped.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
<container name="product.info.grouped.extra" after="product.info.grouped" before="product.info.grouped" as="product_type_data_extra" label="Product Extra Info"/>
1414
</referenceContainer>
1515
<referenceContainer name="product.info.grouped.extra">
16-
<block class="Magento\GroupedProduct\Block\Stockqty\Type\Grouped" template="Magento_CatalogInventory::stockqty/composite.phtml"/>
16+
<block class="Magento\GroupedProduct\Block\Stockqty\Type\Grouped" name="product.info.grouped.stock-composite" template="Magento_CatalogInventory::stockqty/composite.phtml"/>
1717
</referenceContainer>
1818
<referenceContainer name="product.info.type">
19-
<block class="Magento\GroupedProduct\Block\Product\View\Type\Grouped" as="product.info.grouped" template="Magento_GroupedProduct::product/view/type/default.phtml"/>
19+
<block class="Magento\GroupedProduct\Block\Product\View\Type\Grouped" name="product.info.grouped.stock" as="product.info.grouped" template="Magento_GroupedProduct::product/view/type/default.phtml"/>
2020
</referenceContainer>
2121
</body>
2222
</page>

app/design/adminhtml/Magento/backend/web/css/source/actions/_actions-select.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@
108108
min-width: 100%;
109109
position: static;
110110

111+
._parent._visible {
112+
position: relative;
113+
}
114+
111115
.action-submenu {
112116
position: absolute;
113117
}

lib/internal/Magento/Framework/Phrase.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@
99

1010
use Magento\Framework\Phrase\Renderer\Placeholder as RendererPlaceholder;
1111
use Magento\Framework\Phrase\RendererInterface;
12-
use Zend\Stdlib\JsonSerializable;
1312

1413
/**
1514
* @api
1615
*/
17-
class Phrase implements JsonSerializable
16+
class Phrase implements \JsonSerializable
1817
{
1918
/**
2019
* Default phrase renderer. Allows stacking renderers that "don't know about each other"

0 commit comments

Comments
 (0)