Just started playing about with Magento 2.
Can anyone tell me where I can find the "Template Path Hints" option that used to be in System > Configuration > Developer > Debug?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityJust started playing about with Magento 2.
Can anyone tell me where I can find the "Template Path Hints" option that used to be in System > Configuration > Developer > Debug?
You can only see some settings in developer mode
. So first of all check that you are in developer mode, if not then run this command php bin/magento deploy:mode:set developer
in root
directory.
Then go to admin panel:
For Front End:
Store > Configuration > Advanced > Developer > Debug > Enabled Template Path Hints for Storefront > Yes
For Admin :
Store > Configuration > Advanced > Developer > Debug > Enabled
Template Path Hints for Admin > Yes
You can do it by two ways:
goto you project root directory on command line and run below command
php bin/magento dev:template-hints:enable
php bin/magento dev:template-hints:disable
go to admin backend:
Store > Configuration > Advanced > Developer > Debug > Enabled Template Path Hints for Storefront > Yes
Stores > Configuration > Advanced > Developer > Debug > Enabled Template Path Hints for Admin > Yes
Stores > Configuration > Advanced > Developer > Debug > Enabled Template Path Hints for Add Block Names to Hints > Yes
Hope, this will help some extend.
Go to admin
For Front End:
Stores > Configuration > Advanced > Developer > Debug > Enabled Template Path Hints for Storefront > Yes
For Admin :
Stores > Configuration > Advanced > Developer > Debug > Enabled Template Path Hints for Admin > Yes
If you use n98-magerun2 script from https://github.com/netz98/n98-magerun2
Run the following from website root to enable hints
n98-magerun2.phar dev:template-hints --on
And this to disable
n98-magerun2.phar dev:template-hints --off
default
is added by... default. :) and in situations where admin is needed, admin
is used. Majority of stores are usually running one store view/website. n98-magerun does a good job detecting your default view also: github.com/netz98/n98-magerun/blob/… If you're trying to only target a non-default store code, then yes the argument would be required, but without still technically NOT invalid.
If you are connected to database, you can enable by running below query,
For Frontend:
update core_config_data set value = 1 where path = 'dev/debug/template_hints_storefront'
For Admin:
update core_config_data set value = 1 where path = 'dev/debug/template_hints_admin'
Flush Cache
php bin/magento cache:flush OR
php bin/magento cache:clean OR
From admin flush cache
SELECT * FROM
core_config_data` WHERE path
LIKE '%dev/debug%'`
Mar 2, 2017 at 10:09
dev:template-hints:[enable,disable]
, so this is what you need to use from CLI for that version..
With command line we can also disable/enable path hint in Magento 2.2
For Enable
php bin/magento dev:template-hints:enable
For Disable
php bin/magento dev:template-hints:disable
If you don't worry about using a free extension I'd suggest this one:
https://github.com/ho-nl/magento2-Ho_Templatehints
Ho_Templatehints extends the default Magento template hints.
- Easily accessible with with muscle memory
?ath=1
.- Shows hints for Templates, AbstractBlocks (Blocks), Containers and UI Components.
- No layout interference: Using css outline instead of borders of other HTML elements, so it doesn't f'up the layout.
Not really an answer to the question, but hopefully useful if you work with template hints or want to debug layouts/templates.
Open vendor/magento/module-developer/Model/TemplateEngine/Plugin/DebugHints.php
write this code inside afterCreate
function : (at the start, above the storecode line)
if(isset($_GET['shreyasPathHints']) && $_GET['shreyasPathHints'] == 'on'){
return $this->debugHintsFactory->create([
'subject' => $invocationResult,
'showBlockHints' => 1,
]);
}
Now, you can open any Magento page and append ?shreyasPathHints=on
to the URL. No need to run any commands.
P.S. I strongly discourage this method. Only to be used on the local system.
As Magento 1 provided, similarly Magento 2 providing with additional Option "Enabled Template Path Hints for Admin"
Go to admin ->
Store -> Configuration -> Advanced -> Developer -> Debug -> Enabled Template Path Hints for Storefront -> Yes
Store -> Configuration -> Advanced -> Developer -> Debug -> Enabled Template Path Hints for Admin -> Yes
Several of these answers demonstrate use of parameter
This feature has been built into 2.3 for a little while now
Store > configuration > advanced > developer
<field id="template_hints_parameter_value" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Parameter Value</label>
<depends>
<field id="*/*/template_hints_storefront">1</field>
<field id="*/*/template_hints_storefront_show_with_parameter">1</field>
</depends>
<comment>Add the following parameter to the URL to show template hints ?templatehints=[parameter_value]</comment>
</field>