Created
April 4, 2024 13:01
-
-
Save jigarkkarangiya/7a99ffd0049b90e7622e2a5e83c9219c to your computer and use it in GitHub Desktop.
Patch to Show/Add Templates, Blocks and Block Names in the Comment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From: Jigar Karangiya <hello@jigarkarangiya.com> | |
Date: Friday, 23 Feb 2024 17:47:31 +0000 | |
Subject: [PATCH] This Patch Adds Templates, Blocks and Block Names in the comment. | |
diff --git a/vendor/magento/framework/View/Element/Template.php b/vendor/magento/framework/View/Element/Template.php | |
index e9f164ca2..dcd490fd7 100644 | |
--- a/vendor/magento/framework/View/Element/Template.php | |
+++ b/vendor/magento/framework/View/Element/Template.php | |
@@ -297,10 +297,13 @@ class Template extends AbstractBlock | |
*/ | |
protected function _toHtml() | |
{ | |
+ $name = $this->getNameInLayout(); | |
+ $template = $this->getTemplateFile(); | |
+ $class = get_class($this); | |
if (!$this->getTemplate()) { | |
return ''; | |
} | |
- return $this->fetchView($this->getTemplateFile()); | |
+ return "<!-- BEGIN ($name) Block-($class) -->\n". $this->fetchView($this->getTemplateFile()) . "<!-- END ($name) Template-($template) -->"; | |
} | |
/** | |
diff --git a/vendor/magento/framework/View/Layout.php b/vendor/magento/framework/View/Layout.php | |
index eeba7485e..2bb041c78 100644 | |
--- a/vendor/magento/framework/View/Layout.php | |
+++ b/vendor/magento/framework/View/Layout.php | |
@@ -554,7 +554,7 @@ class Layout extends \Magento\Framework\Simplexml\Config implements \Magento\Fra | |
} elseif ($this->isBlock($name)) { | |
$result = $this->_renderBlock($name); | |
} else { | |
- $result = $this->_renderContainer($name, false); | |
+ $result = "<!-- >> START Container : " . $name . " << -->" . $this->_renderContainer($name, false) . "<!-- >> END Container : " . $name . " << -->"; | |
} | |
} catch (\Exception $e) { | |
if ($this->appState->getMode() === AppState::MODE_DEVELOPER) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment