Magento 2 || Force enable template hints - mpaz-redstage/magento-snippets GitHub Wiki
On file
vendor/magento/module-developer/Model/TemplateEngine/Plugin/DebugHints.php
Replace the entire function:
public function afterCreate(
TemplateEngineFactory $subject,
TemplateEngineInterface $invocationResult
) {
...
if ($showHints) {
$showBlockHints = $this->scopeConfig->getValue(
self::XML_PATH_DEBUG_TEMPLATE_HINTS_BLOCKS,
ScopeInterface::SCOPE_STORE,
$storeCode
);
//This return needs to be above
return $this->debugHintsFactory->create([
'subject' => $invocationResult,
'showBlockHints' => $showBlockHints,
]);
//This return needs to be above
}
}
//Insert this return here
return $this->debugHintsFactory->create([
'subject' => $invocationResult,
'showBlockHints' => true,
]);
//Insert this return here
return $invocationResult;
}
How to show the php block:
src/src/vendor/magento/module-developer/Model/TemplateEngine/Decorator/DebugHints.php
comment the 'if' on this function
public function render(\Magento\Framework\View\Element\BlockInterface $block, $templateFile, array $dictionary = [])
{
$result = $this->_subject->render($block, $templateFile, $dictionary);
//if ($this->_showBlockHints) {
$result = $this->_renderBlockHints($result, $block);
//}
$result = $this->_renderTemplateHints($result, $templateFile);
return $result;
}