14
14
use Magento \Framework \View \TemplateEngineInterface ;
15
15
use Magento \Store \Model \ScopeInterface ;
16
16
use Magento \Store \Model \StoreManagerInterface ;
17
+ use Magento \Framework \App \Request \Http ;
17
18
18
19
/**
19
20
* Class \Magento\Developer\Model\TemplateEngine\Plugin\DebugHints
@@ -57,25 +58,52 @@ class DebugHints
57
58
*/
58
59
protected $ debugHintsPath ;
59
60
61
+ /**
62
+ * XPath of configuration of the debug hints show with parameter
63
+ *
64
+ * dev/debug/template_hints_storefront_show_with_parameter
65
+ *
66
+ * @var string
67
+ */
68
+ protected $ debugHintsShowWithParameter ;
69
+
70
+ /**
71
+ * XPath of configuration of the debug hints URL parameter
72
+ *
73
+ * dev/debug/template_hints_parameter_value
74
+ *
75
+ * @var string
76
+ */
77
+ protected $ debugHintsParameter ;
78
+
60
79
/**
61
80
* @param ScopeConfigInterface $scopeConfig
62
81
* @param StoreManagerInterface $storeManager
63
82
* @param DevHelper $devHelper
64
83
* @param DebugHintsFactory $debugHintsFactory
65
84
* @param string $debugHintsPath
85
+ * @param Http $http
86
+ * @param string $debugHintsShowWithParameter
87
+ * @param string $debugHintsParameter
66
88
*/
67
89
public function __construct (
68
90
ScopeConfigInterface $ scopeConfig ,
69
91
StoreManagerInterface $ storeManager ,
70
92
DevHelper $ devHelper ,
71
93
DebugHintsFactory $ debugHintsFactory ,
72
- $ debugHintsPath
94
+ $ debugHintsPath ,
95
+ Http $ http ,
96
+ $ debugHintsShowWithParameter ,
97
+ $ debugHintsParameter
73
98
) {
74
99
$ this ->scopeConfig = $ scopeConfig ;
75
100
$ this ->storeManager = $ storeManager ;
76
101
$ this ->devHelper = $ devHelper ;
77
102
$ this ->debugHintsFactory = $ debugHintsFactory ;
78
103
$ this ->debugHintsPath = $ debugHintsPath ;
104
+ $ this ->http = $ http ;
105
+ $ this ->debugHintsShowWithParameter = $ debugHintsShowWithParameter ;
106
+ $ this ->debugHintsParameter = $ debugHintsParameter ;
79
107
}
80
108
81
109
/**
@@ -94,15 +122,30 @@ public function afterCreate(
94
122
$ storeCode = $ this ->storeManager ->getStore ()->getCode ();
95
123
if ($ this ->scopeConfig ->getValue ($ this ->debugHintsPath , ScopeInterface::SCOPE_STORE , $ storeCode )
96
124
&& $ this ->devHelper ->isDevAllowed ()) {
97
- $ showBlockHints = $ this ->scopeConfig ->getValue (
98
- self ::XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS ,
125
+ $ debugHintsShowWithParameter = $ this ->scopeConfig ->getValue (
126
+ $ this ->debugHintsShowWithParameter ,
127
+ ScopeInterface::SCOPE_STORE ,
128
+ $ storeCode
129
+ );
130
+ $ debugHintsParameter = $ this ->scopeConfig ->getValue (
131
+ $ this ->debugHintsParameter ,
99
132
ScopeInterface::SCOPE_STORE ,
100
133
$ storeCode
101
134
);
102
- return $ this ->debugHintsFactory ->create ([
103
- 'subject ' => $ invocationResult ,
104
- 'showBlockHints ' => $ showBlockHints ,
105
- ]);
135
+ $ debugHintsParameterInUrl = $ this ->http ->getParam ('templatehints ' );
136
+ if ((!$ debugHintsShowWithParameter ) ||
137
+ ($ debugHintsShowWithParameter &&
138
+ $ debugHintsParameter == $ debugHintsParameterInUrl )) {
139
+ $ showBlockHints = $ this ->scopeConfig ->getValue (
140
+ self ::XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS ,
141
+ ScopeInterface::SCOPE_STORE ,
142
+ $ storeCode
143
+ );
144
+ return $ this ->debugHintsFactory ->create ([
145
+ 'subject ' => $ invocationResult ,
146
+ 'showBlockHints ' => $ showBlockHints ,
147
+ ]);
148
+ }
106
149
}
107
150
return $ invocationResult ;
108
151
}
0 commit comments