Find out the “name” for a referenceBlock in Magento 2Hide “Stored Payment Method” in M2 My...
Different result between scanning in Epson's "color negative film" mode and scanning in positive -> invert curve in post?
You cannot touch me, but I can touch you, who am I?
Crossing the line between justified force and brutality
Why not increase contact surface when reentering the atmosphere?
Failed to fetch jessie backports repository
Roman Numeral Treatment of Suspensions
Pre-amplifier input protection
Hostile work environment after whistle-blowing on coworker and our boss. What do I do?
What is paid subscription needed for in Mortal Kombat 11?
Customer Requests (Sometimes) Drive Me Bonkers!
Why, precisely, is argon used in neutrino experiments?
Gears on left are inverse to gears on right?
What is the intuitive meaning of having a linear relationship between the logs of two variables?
Short story about space worker geeks who zone out by 'listening' to radiation from stars
Is `x >> pure y` equivalent to `liftM (const y) x`
Class Action - which options I have?
Is HostGator storing my password in plaintext?
How to be diplomatic in refusing to write code that breaches the privacy of our users
Integer addition + constant, is it a group?
Proof of work - lottery approach
What is the best translation for "slot" in the context of multiplayer video games?
How do scammers retract money, while you can’t?
How do I rename a Linux host without needing to reboot for the rename to take effect?
How to pronounce the slash sign
Find out the “name” for a referenceBlock in Magento 2
Hide “Stored Payment Method” in M2 My AccountMove Logo inside DivHow can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlHow to find name of blockmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2 - block name vs as nameRemove block not working in custom xml layout?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2: Remove ReferenceBlock - Order Information
I want to remove some blocks from my page. Say for example that I want to remove the container for the logo.
Then I create /app/design/frontend/MYVENDORNAME/MYTHEMENAME/Magento_Theme/layout/default.xml
with the following code:
<page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<referenceBlock name="logo" remove="true"/>
</page>
In this case I managed to find out the name (name="logo") of this reference block by searching through the files in the Base Theme.
The question is: Is there a better way to find out the names of blocks. I figure there must be a list of all names used in the XMl files in Magento? Or some kind of reference?
Say for example that I would like to remove the menu (<div class="sections nav-sections">...</div>
). How do I find out the name of that
magento2 layout xml
add a comment |
I want to remove some blocks from my page. Say for example that I want to remove the container for the logo.
Then I create /app/design/frontend/MYVENDORNAME/MYTHEMENAME/Magento_Theme/layout/default.xml
with the following code:
<page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<referenceBlock name="logo" remove="true"/>
</page>
In this case I managed to find out the name (name="logo") of this reference block by searching through the files in the Base Theme.
The question is: Is there a better way to find out the names of blocks. I figure there must be a list of all names used in the XMl files in Magento? Or some kind of reference?
Say for example that I would like to remove the menu (<div class="sections nav-sections">...</div>
). How do I find out the name of that
magento2 layout xml
1
u can find it in XML file in base theme. if you like to remove the menu this name iscatalog.topnav
. i find it in default.xml in module Theme in base.
– xanka
Feb 18 '16 at 1:26
add a comment |
I want to remove some blocks from my page. Say for example that I want to remove the container for the logo.
Then I create /app/design/frontend/MYVENDORNAME/MYTHEMENAME/Magento_Theme/layout/default.xml
with the following code:
<page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<referenceBlock name="logo" remove="true"/>
</page>
In this case I managed to find out the name (name="logo") of this reference block by searching through the files in the Base Theme.
The question is: Is there a better way to find out the names of blocks. I figure there must be a list of all names used in the XMl files in Magento? Or some kind of reference?
Say for example that I would like to remove the menu (<div class="sections nav-sections">...</div>
). How do I find out the name of that
magento2 layout xml
I want to remove some blocks from my page. Say for example that I want to remove the container for the logo.
Then I create /app/design/frontend/MYVENDORNAME/MYTHEMENAME/Magento_Theme/layout/default.xml
with the following code:
<page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<referenceBlock name="logo" remove="true"/>
</page>
In this case I managed to find out the name (name="logo") of this reference block by searching through the files in the Base Theme.
The question is: Is there a better way to find out the names of blocks. I figure there must be a list of all names used in the XMl files in Magento? Or some kind of reference?
Say for example that I would like to remove the menu (<div class="sections nav-sections">...</div>
). How do I find out the name of that
magento2 layout xml
magento2 layout xml
asked Feb 18 '16 at 0:00
GordovaGordova
1711412
1711412
1
u can find it in XML file in base theme. if you like to remove the menu this name iscatalog.topnav
. i find it in default.xml in module Theme in base.
– xanka
Feb 18 '16 at 1:26
add a comment |
1
u can find it in XML file in base theme. if you like to remove the menu this name iscatalog.topnav
. i find it in default.xml in module Theme in base.
– xanka
Feb 18 '16 at 1:26
1
1
u can find it in XML file in base theme. if you like to remove the menu this name is
catalog.topnav
. i find it in default.xml in module Theme in base.– xanka
Feb 18 '16 at 1:26
u can find it in XML file in base theme. if you like to remove the menu this name is
catalog.topnav
. i find it in default.xml in module Theme in base.– xanka
Feb 18 '16 at 1:26
add a comment |
5 Answers
5
active
oldest
votes
There are a couple of ways to do this:
- Guess
- Review Layout for Base, Blank and Luma Themes
- Perform IDE Searches for Class and ID Names
- Enable 'Enabled Template Path Hints for Storefront' and 'Add Block Names to Hints'.
You can enable path hints and block hints by logging into the admin interface and going to:
Stores > Configuration > Advanced > Developer > Debug
Unfortunately, there's still no surefire way to find these easily, as far as I know. Though it looks like the guys working on the core are on to it:
https://github.com/magento/magento2/issues/571
As Gareth said, you can enable template path hints to try to figure out wich template and block is rendering that part of the code.
– Barbanet
Feb 21 '16 at 20:32
2
I like how you said 'guess', path hints is pretty useless in some cases.
– wlin
May 24 '16 at 19:15
#4 did not work for me in the first instance, because I did not whitelist my IP as described here: docs.magento.com/m2/ee/user_guide/system/…
– where
Aug 13 '18 at 0:05
add a comment |
Here's how I find them...
Content > Widgets > Add Widget
Type = CMS Static Block
Design Theme = [Your Theme]
Continue
Layout Updates > Add Layout
Display On = [Pick One]
Right click Inspect on "Please Select" underneath Container.
Expand the <select>
element in Dev Tools
All the option value='s are your referenceContainer Names.
:)
Why don't we see referenceContainers like header.panel or page.wrapper in this list ?
– maxagaz
Oct 20 '17 at 8:23
1
Thank you very much! You think magento 2 devs would provide a quick reference to find these names in their docs. Much appreciated for your helpful tip :)
– Jonathan Marzullo
Jan 3 '18 at 18:43
You need to select "Page Layouts" in the "Display On" drop down, then you will see all the reference containers
– Samyer
Aug 30 '18 at 15:00
Thank you! This worked a treat for me - obvious now!
– Freshwebs
Feb 7 at 16:37
add a comment |
You can use this free extension:
https://github.com/ho-nl/magento2-Ho_Templatehints
Or following @blizam answer some references picked from the widgets:
After Page Header > page.top
After Page Header Top > top.container
Before Main Columns > columns.top
Before Page Footer > page.bottom
Before Page Footer Container > page.bottom.container
CMS Footer Links > cms_footer_links_container
Compare Link Wrapper > compare-link-wrapper
Main Content Area > content
Main Content Aside > content.aside
Main Content Bottom > content.bottom
Main Content Container > main
Main Content Top > content.top
Mini-cart promotion block > minicart.addons
Page Bottom > before.body.end
Page Footer > footer
Page Footer Container > footer-container
Page Header > header-wrapper
Page Header Container > header.container
Page Header Panel > header.panel
Page Top > after.body.start
Sidebar Additional > sidebar.additional
Sidebar Main > sidebar.main
add a comment |
You can execute the php-cli code below to get a list of all the ~200 referenceBlock
. Make sure the path to your Magento 2 root folder is correct. You can also change the instruction
variable to list block
, container
and referenceContainer
.
<?php
//$instruction = "container";
//$instruction = "referenceContainer";
$instruction = "block";
//$instruction = "referenceBlock";
$path = '/var/www/html/magento2/vendor/magento';
$command = 'cd '.$path.' && egrep -r -i --include *.xml "<'.$instruction.'".*?"name=" *';
exec($command, $output);
$container_max_length = 1;
$pattern = '/(.*?):.*<'.$instruction.'.*name="(.*?)".*/';
foreach ($output as $subject) {
preg_match($pattern, $subject, $matches);
$containers[$matches[2]][] = $matches[1];
if (strlen($matches[2]) > $container_max_length) $container_max_length = strlen($matches[2]);
}
$n=1;
ksort($containers);
foreach ($containers as $k => $v) {
printf("%6s", "$n. ");
printf("%-".$container_max_length."s".$v[0]."n", $k);
$i=1;
while (isset($v[$i])) {
printf(" %-".$container_max_length."s".$v[$i]."n", "");
$i++;
}
$n++;
}
?>
Genius. This method is so priceless. Thank you so much for sharing.
– crashtestxxx
Nov 4 '17 at 18:35
This is awesome thanks very much super helpful. I modified it into one that would dump all of them out as text files for the entire site. gist.github.com/LiamKarlMitchell/…
– Liam Mitchell
Mar 1 at 6:22
add a comment |
I put together a little module that will write the XML page structure to a log file in the var/log/
folder.
app/code/CustomerParadigm/PageXml/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="CustomerParadigm_PageXml" setup_version="1.0.0" schema_version="1.0.0">
<sequence>
<module name="Magento_Catalog"/>
<module name="Magento_Theme"/>
</sequence>
</module>
</config>
app/code/CustomerParadigm/PageXml/etc/events.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="layout_generate_blocks_after">
<observer name="customerparadigm_layout_generate_blocks_after" instance="CustomerParadigmPageXmlModelLayout" />
</event>
</config>
app/code/CustomerParadigm/PageXml/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'CustomerParadigm_PageXml',
__DIR__
);
app/code/CustomerParadigm/PageXml/Model/Layout.php
<?php
namespace CustomerParadigmPageXmlModel;
use MagentoFrameworkEventObserver;
use MagentoFrameworkEventObserverInterface;
class Layout implements ObserverInterface {
protected $_logger;
public function __construct ( PsrLogLoggerInterface $logger ) {
$this->_logger = $logger;
}
public function execute(MagentoFrameworkEventObserver $observer) {
$log_file = BP . '/var/log/page_layout.xml';
if (file_exists($log_file)) {
unlink($log_file);
}
$xml = $observer->getEvent()->getLayout()->getXmlString();
/*$this->_logger->debug($xml);*/
$writer = new ZendLogWriterStream($log_file);
$logger = new ZendLogLogger();
$logger->addWriter($writer);
$logger->info($xml);
return $this;
}
}
Nothing too amazing going on here, and i'm sure there is plenty of room to improve (working with the built in logger is one of them) but it gets the job done for me when i'm developing a site.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f102260%2ffind-out-the-name-for-a-referenceblock-in-magento-2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
There are a couple of ways to do this:
- Guess
- Review Layout for Base, Blank and Luma Themes
- Perform IDE Searches for Class and ID Names
- Enable 'Enabled Template Path Hints for Storefront' and 'Add Block Names to Hints'.
You can enable path hints and block hints by logging into the admin interface and going to:
Stores > Configuration > Advanced > Developer > Debug
Unfortunately, there's still no surefire way to find these easily, as far as I know. Though it looks like the guys working on the core are on to it:
https://github.com/magento/magento2/issues/571
As Gareth said, you can enable template path hints to try to figure out wich template and block is rendering that part of the code.
– Barbanet
Feb 21 '16 at 20:32
2
I like how you said 'guess', path hints is pretty useless in some cases.
– wlin
May 24 '16 at 19:15
#4 did not work for me in the first instance, because I did not whitelist my IP as described here: docs.magento.com/m2/ee/user_guide/system/…
– where
Aug 13 '18 at 0:05
add a comment |
There are a couple of ways to do this:
- Guess
- Review Layout for Base, Blank and Luma Themes
- Perform IDE Searches for Class and ID Names
- Enable 'Enabled Template Path Hints for Storefront' and 'Add Block Names to Hints'.
You can enable path hints and block hints by logging into the admin interface and going to:
Stores > Configuration > Advanced > Developer > Debug
Unfortunately, there's still no surefire way to find these easily, as far as I know. Though it looks like the guys working on the core are on to it:
https://github.com/magento/magento2/issues/571
As Gareth said, you can enable template path hints to try to figure out wich template and block is rendering that part of the code.
– Barbanet
Feb 21 '16 at 20:32
2
I like how you said 'guess', path hints is pretty useless in some cases.
– wlin
May 24 '16 at 19:15
#4 did not work for me in the first instance, because I did not whitelist my IP as described here: docs.magento.com/m2/ee/user_guide/system/…
– where
Aug 13 '18 at 0:05
add a comment |
There are a couple of ways to do this:
- Guess
- Review Layout for Base, Blank and Luma Themes
- Perform IDE Searches for Class and ID Names
- Enable 'Enabled Template Path Hints for Storefront' and 'Add Block Names to Hints'.
You can enable path hints and block hints by logging into the admin interface and going to:
Stores > Configuration > Advanced > Developer > Debug
Unfortunately, there's still no surefire way to find these easily, as far as I know. Though it looks like the guys working on the core are on to it:
https://github.com/magento/magento2/issues/571
There are a couple of ways to do this:
- Guess
- Review Layout for Base, Blank and Luma Themes
- Perform IDE Searches for Class and ID Names
- Enable 'Enabled Template Path Hints for Storefront' and 'Add Block Names to Hints'.
You can enable path hints and block hints by logging into the admin interface and going to:
Stores > Configuration > Advanced > Developer > Debug
Unfortunately, there's still no surefire way to find these easily, as far as I know. Though it looks like the guys working on the core are on to it:
https://github.com/magento/magento2/issues/571
answered Feb 21 '16 at 20:15
Gareth DaineGareth Daine
5551411
5551411
As Gareth said, you can enable template path hints to try to figure out wich template and block is rendering that part of the code.
– Barbanet
Feb 21 '16 at 20:32
2
I like how you said 'guess', path hints is pretty useless in some cases.
– wlin
May 24 '16 at 19:15
#4 did not work for me in the first instance, because I did not whitelist my IP as described here: docs.magento.com/m2/ee/user_guide/system/…
– where
Aug 13 '18 at 0:05
add a comment |
As Gareth said, you can enable template path hints to try to figure out wich template and block is rendering that part of the code.
– Barbanet
Feb 21 '16 at 20:32
2
I like how you said 'guess', path hints is pretty useless in some cases.
– wlin
May 24 '16 at 19:15
#4 did not work for me in the first instance, because I did not whitelist my IP as described here: docs.magento.com/m2/ee/user_guide/system/…
– where
Aug 13 '18 at 0:05
As Gareth said, you can enable template path hints to try to figure out wich template and block is rendering that part of the code.
– Barbanet
Feb 21 '16 at 20:32
As Gareth said, you can enable template path hints to try to figure out wich template and block is rendering that part of the code.
– Barbanet
Feb 21 '16 at 20:32
2
2
I like how you said 'guess', path hints is pretty useless in some cases.
– wlin
May 24 '16 at 19:15
I like how you said 'guess', path hints is pretty useless in some cases.
– wlin
May 24 '16 at 19:15
#4 did not work for me in the first instance, because I did not whitelist my IP as described here: docs.magento.com/m2/ee/user_guide/system/…
– where
Aug 13 '18 at 0:05
#4 did not work for me in the first instance, because I did not whitelist my IP as described here: docs.magento.com/m2/ee/user_guide/system/…
– where
Aug 13 '18 at 0:05
add a comment |
Here's how I find them...
Content > Widgets > Add Widget
Type = CMS Static Block
Design Theme = [Your Theme]
Continue
Layout Updates > Add Layout
Display On = [Pick One]
Right click Inspect on "Please Select" underneath Container.
Expand the <select>
element in Dev Tools
All the option value='s are your referenceContainer Names.
:)
Why don't we see referenceContainers like header.panel or page.wrapper in this list ?
– maxagaz
Oct 20 '17 at 8:23
1
Thank you very much! You think magento 2 devs would provide a quick reference to find these names in their docs. Much appreciated for your helpful tip :)
– Jonathan Marzullo
Jan 3 '18 at 18:43
You need to select "Page Layouts" in the "Display On" drop down, then you will see all the reference containers
– Samyer
Aug 30 '18 at 15:00
Thank you! This worked a treat for me - obvious now!
– Freshwebs
Feb 7 at 16:37
add a comment |
Here's how I find them...
Content > Widgets > Add Widget
Type = CMS Static Block
Design Theme = [Your Theme]
Continue
Layout Updates > Add Layout
Display On = [Pick One]
Right click Inspect on "Please Select" underneath Container.
Expand the <select>
element in Dev Tools
All the option value='s are your referenceContainer Names.
:)
Why don't we see referenceContainers like header.panel or page.wrapper in this list ?
– maxagaz
Oct 20 '17 at 8:23
1
Thank you very much! You think magento 2 devs would provide a quick reference to find these names in their docs. Much appreciated for your helpful tip :)
– Jonathan Marzullo
Jan 3 '18 at 18:43
You need to select "Page Layouts" in the "Display On" drop down, then you will see all the reference containers
– Samyer
Aug 30 '18 at 15:00
Thank you! This worked a treat for me - obvious now!
– Freshwebs
Feb 7 at 16:37
add a comment |
Here's how I find them...
Content > Widgets > Add Widget
Type = CMS Static Block
Design Theme = [Your Theme]
Continue
Layout Updates > Add Layout
Display On = [Pick One]
Right click Inspect on "Please Select" underneath Container.
Expand the <select>
element in Dev Tools
All the option value='s are your referenceContainer Names.
:)
Here's how I find them...
Content > Widgets > Add Widget
Type = CMS Static Block
Design Theme = [Your Theme]
Continue
Layout Updates > Add Layout
Display On = [Pick One]
Right click Inspect on "Please Select" underneath Container.
Expand the <select>
element in Dev Tools
All the option value='s are your referenceContainer Names.
:)
edited Sep 27 '17 at 11:36
András Tóth
466
466
answered Feb 28 '17 at 18:07
blizamblizam
15113
15113
Why don't we see referenceContainers like header.panel or page.wrapper in this list ?
– maxagaz
Oct 20 '17 at 8:23
1
Thank you very much! You think magento 2 devs would provide a quick reference to find these names in their docs. Much appreciated for your helpful tip :)
– Jonathan Marzullo
Jan 3 '18 at 18:43
You need to select "Page Layouts" in the "Display On" drop down, then you will see all the reference containers
– Samyer
Aug 30 '18 at 15:00
Thank you! This worked a treat for me - obvious now!
– Freshwebs
Feb 7 at 16:37
add a comment |
Why don't we see referenceContainers like header.panel or page.wrapper in this list ?
– maxagaz
Oct 20 '17 at 8:23
1
Thank you very much! You think magento 2 devs would provide a quick reference to find these names in their docs. Much appreciated for your helpful tip :)
– Jonathan Marzullo
Jan 3 '18 at 18:43
You need to select "Page Layouts" in the "Display On" drop down, then you will see all the reference containers
– Samyer
Aug 30 '18 at 15:00
Thank you! This worked a treat for me - obvious now!
– Freshwebs
Feb 7 at 16:37
Why don't we see referenceContainers like header.panel or page.wrapper in this list ?
– maxagaz
Oct 20 '17 at 8:23
Why don't we see referenceContainers like header.panel or page.wrapper in this list ?
– maxagaz
Oct 20 '17 at 8:23
1
1
Thank you very much! You think magento 2 devs would provide a quick reference to find these names in their docs. Much appreciated for your helpful tip :)
– Jonathan Marzullo
Jan 3 '18 at 18:43
Thank you very much! You think magento 2 devs would provide a quick reference to find these names in their docs. Much appreciated for your helpful tip :)
– Jonathan Marzullo
Jan 3 '18 at 18:43
You need to select "Page Layouts" in the "Display On" drop down, then you will see all the reference containers
– Samyer
Aug 30 '18 at 15:00
You need to select "Page Layouts" in the "Display On" drop down, then you will see all the reference containers
– Samyer
Aug 30 '18 at 15:00
Thank you! This worked a treat for me - obvious now!
– Freshwebs
Feb 7 at 16:37
Thank you! This worked a treat for me - obvious now!
– Freshwebs
Feb 7 at 16:37
add a comment |
You can use this free extension:
https://github.com/ho-nl/magento2-Ho_Templatehints
Or following @blizam answer some references picked from the widgets:
After Page Header > page.top
After Page Header Top > top.container
Before Main Columns > columns.top
Before Page Footer > page.bottom
Before Page Footer Container > page.bottom.container
CMS Footer Links > cms_footer_links_container
Compare Link Wrapper > compare-link-wrapper
Main Content Area > content
Main Content Aside > content.aside
Main Content Bottom > content.bottom
Main Content Container > main
Main Content Top > content.top
Mini-cart promotion block > minicart.addons
Page Bottom > before.body.end
Page Footer > footer
Page Footer Container > footer-container
Page Header > header-wrapper
Page Header Container > header.container
Page Header Panel > header.panel
Page Top > after.body.start
Sidebar Additional > sidebar.additional
Sidebar Main > sidebar.main
add a comment |
You can use this free extension:
https://github.com/ho-nl/magento2-Ho_Templatehints
Or following @blizam answer some references picked from the widgets:
After Page Header > page.top
After Page Header Top > top.container
Before Main Columns > columns.top
Before Page Footer > page.bottom
Before Page Footer Container > page.bottom.container
CMS Footer Links > cms_footer_links_container
Compare Link Wrapper > compare-link-wrapper
Main Content Area > content
Main Content Aside > content.aside
Main Content Bottom > content.bottom
Main Content Container > main
Main Content Top > content.top
Mini-cart promotion block > minicart.addons
Page Bottom > before.body.end
Page Footer > footer
Page Footer Container > footer-container
Page Header > header-wrapper
Page Header Container > header.container
Page Header Panel > header.panel
Page Top > after.body.start
Sidebar Additional > sidebar.additional
Sidebar Main > sidebar.main
add a comment |
You can use this free extension:
https://github.com/ho-nl/magento2-Ho_Templatehints
Or following @blizam answer some references picked from the widgets:
After Page Header > page.top
After Page Header Top > top.container
Before Main Columns > columns.top
Before Page Footer > page.bottom
Before Page Footer Container > page.bottom.container
CMS Footer Links > cms_footer_links_container
Compare Link Wrapper > compare-link-wrapper
Main Content Area > content
Main Content Aside > content.aside
Main Content Bottom > content.bottom
Main Content Container > main
Main Content Top > content.top
Mini-cart promotion block > minicart.addons
Page Bottom > before.body.end
Page Footer > footer
Page Footer Container > footer-container
Page Header > header-wrapper
Page Header Container > header.container
Page Header Panel > header.panel
Page Top > after.body.start
Sidebar Additional > sidebar.additional
Sidebar Main > sidebar.main
You can use this free extension:
https://github.com/ho-nl/magento2-Ho_Templatehints
Or following @blizam answer some references picked from the widgets:
After Page Header > page.top
After Page Header Top > top.container
Before Main Columns > columns.top
Before Page Footer > page.bottom
Before Page Footer Container > page.bottom.container
CMS Footer Links > cms_footer_links_container
Compare Link Wrapper > compare-link-wrapper
Main Content Area > content
Main Content Aside > content.aside
Main Content Bottom > content.bottom
Main Content Container > main
Main Content Top > content.top
Mini-cart promotion block > minicart.addons
Page Bottom > before.body.end
Page Footer > footer
Page Footer Container > footer-container
Page Header > header-wrapper
Page Header Container > header.container
Page Header Panel > header.panel
Page Top > after.body.start
Sidebar Additional > sidebar.additional
Sidebar Main > sidebar.main
edited Feb 13 '18 at 14:48
answered Feb 13 '18 at 14:27
open-ecommerce.orgopen-ecommerce.org
285213
285213
add a comment |
add a comment |
You can execute the php-cli code below to get a list of all the ~200 referenceBlock
. Make sure the path to your Magento 2 root folder is correct. You can also change the instruction
variable to list block
, container
and referenceContainer
.
<?php
//$instruction = "container";
//$instruction = "referenceContainer";
$instruction = "block";
//$instruction = "referenceBlock";
$path = '/var/www/html/magento2/vendor/magento';
$command = 'cd '.$path.' && egrep -r -i --include *.xml "<'.$instruction.'".*?"name=" *';
exec($command, $output);
$container_max_length = 1;
$pattern = '/(.*?):.*<'.$instruction.'.*name="(.*?)".*/';
foreach ($output as $subject) {
preg_match($pattern, $subject, $matches);
$containers[$matches[2]][] = $matches[1];
if (strlen($matches[2]) > $container_max_length) $container_max_length = strlen($matches[2]);
}
$n=1;
ksort($containers);
foreach ($containers as $k => $v) {
printf("%6s", "$n. ");
printf("%-".$container_max_length."s".$v[0]."n", $k);
$i=1;
while (isset($v[$i])) {
printf(" %-".$container_max_length."s".$v[$i]."n", "");
$i++;
}
$n++;
}
?>
Genius. This method is so priceless. Thank you so much for sharing.
– crashtestxxx
Nov 4 '17 at 18:35
This is awesome thanks very much super helpful. I modified it into one that would dump all of them out as text files for the entire site. gist.github.com/LiamKarlMitchell/…
– Liam Mitchell
Mar 1 at 6:22
add a comment |
You can execute the php-cli code below to get a list of all the ~200 referenceBlock
. Make sure the path to your Magento 2 root folder is correct. You can also change the instruction
variable to list block
, container
and referenceContainer
.
<?php
//$instruction = "container";
//$instruction = "referenceContainer";
$instruction = "block";
//$instruction = "referenceBlock";
$path = '/var/www/html/magento2/vendor/magento';
$command = 'cd '.$path.' && egrep -r -i --include *.xml "<'.$instruction.'".*?"name=" *';
exec($command, $output);
$container_max_length = 1;
$pattern = '/(.*?):.*<'.$instruction.'.*name="(.*?)".*/';
foreach ($output as $subject) {
preg_match($pattern, $subject, $matches);
$containers[$matches[2]][] = $matches[1];
if (strlen($matches[2]) > $container_max_length) $container_max_length = strlen($matches[2]);
}
$n=1;
ksort($containers);
foreach ($containers as $k => $v) {
printf("%6s", "$n. ");
printf("%-".$container_max_length."s".$v[0]."n", $k);
$i=1;
while (isset($v[$i])) {
printf(" %-".$container_max_length."s".$v[$i]."n", "");
$i++;
}
$n++;
}
?>
Genius. This method is so priceless. Thank you so much for sharing.
– crashtestxxx
Nov 4 '17 at 18:35
This is awesome thanks very much super helpful. I modified it into one that would dump all of them out as text files for the entire site. gist.github.com/LiamKarlMitchell/…
– Liam Mitchell
Mar 1 at 6:22
add a comment |
You can execute the php-cli code below to get a list of all the ~200 referenceBlock
. Make sure the path to your Magento 2 root folder is correct. You can also change the instruction
variable to list block
, container
and referenceContainer
.
<?php
//$instruction = "container";
//$instruction = "referenceContainer";
$instruction = "block";
//$instruction = "referenceBlock";
$path = '/var/www/html/magento2/vendor/magento';
$command = 'cd '.$path.' && egrep -r -i --include *.xml "<'.$instruction.'".*?"name=" *';
exec($command, $output);
$container_max_length = 1;
$pattern = '/(.*?):.*<'.$instruction.'.*name="(.*?)".*/';
foreach ($output as $subject) {
preg_match($pattern, $subject, $matches);
$containers[$matches[2]][] = $matches[1];
if (strlen($matches[2]) > $container_max_length) $container_max_length = strlen($matches[2]);
}
$n=1;
ksort($containers);
foreach ($containers as $k => $v) {
printf("%6s", "$n. ");
printf("%-".$container_max_length."s".$v[0]."n", $k);
$i=1;
while (isset($v[$i])) {
printf(" %-".$container_max_length."s".$v[$i]."n", "");
$i++;
}
$n++;
}
?>
You can execute the php-cli code below to get a list of all the ~200 referenceBlock
. Make sure the path to your Magento 2 root folder is correct. You can also change the instruction
variable to list block
, container
and referenceContainer
.
<?php
//$instruction = "container";
//$instruction = "referenceContainer";
$instruction = "block";
//$instruction = "referenceBlock";
$path = '/var/www/html/magento2/vendor/magento';
$command = 'cd '.$path.' && egrep -r -i --include *.xml "<'.$instruction.'".*?"name=" *';
exec($command, $output);
$container_max_length = 1;
$pattern = '/(.*?):.*<'.$instruction.'.*name="(.*?)".*/';
foreach ($output as $subject) {
preg_match($pattern, $subject, $matches);
$containers[$matches[2]][] = $matches[1];
if (strlen($matches[2]) > $container_max_length) $container_max_length = strlen($matches[2]);
}
$n=1;
ksort($containers);
foreach ($containers as $k => $v) {
printf("%6s", "$n. ");
printf("%-".$container_max_length."s".$v[0]."n", $k);
$i=1;
while (isset($v[$i])) {
printf(" %-".$container_max_length."s".$v[$i]."n", "");
$i++;
}
$n++;
}
?>
edited 17 mins ago
answered Oct 22 '17 at 15:47
maxagazmaxagaz
421425
421425
Genius. This method is so priceless. Thank you so much for sharing.
– crashtestxxx
Nov 4 '17 at 18:35
This is awesome thanks very much super helpful. I modified it into one that would dump all of them out as text files for the entire site. gist.github.com/LiamKarlMitchell/…
– Liam Mitchell
Mar 1 at 6:22
add a comment |
Genius. This method is so priceless. Thank you so much for sharing.
– crashtestxxx
Nov 4 '17 at 18:35
This is awesome thanks very much super helpful. I modified it into one that would dump all of them out as text files for the entire site. gist.github.com/LiamKarlMitchell/…
– Liam Mitchell
Mar 1 at 6:22
Genius. This method is so priceless. Thank you so much for sharing.
– crashtestxxx
Nov 4 '17 at 18:35
Genius. This method is so priceless. Thank you so much for sharing.
– crashtestxxx
Nov 4 '17 at 18:35
This is awesome thanks very much super helpful. I modified it into one that would dump all of them out as text files for the entire site. gist.github.com/LiamKarlMitchell/…
– Liam Mitchell
Mar 1 at 6:22
This is awesome thanks very much super helpful. I modified it into one that would dump all of them out as text files for the entire site. gist.github.com/LiamKarlMitchell/…
– Liam Mitchell
Mar 1 at 6:22
add a comment |
I put together a little module that will write the XML page structure to a log file in the var/log/
folder.
app/code/CustomerParadigm/PageXml/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="CustomerParadigm_PageXml" setup_version="1.0.0" schema_version="1.0.0">
<sequence>
<module name="Magento_Catalog"/>
<module name="Magento_Theme"/>
</sequence>
</module>
</config>
app/code/CustomerParadigm/PageXml/etc/events.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="layout_generate_blocks_after">
<observer name="customerparadigm_layout_generate_blocks_after" instance="CustomerParadigmPageXmlModelLayout" />
</event>
</config>
app/code/CustomerParadigm/PageXml/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'CustomerParadigm_PageXml',
__DIR__
);
app/code/CustomerParadigm/PageXml/Model/Layout.php
<?php
namespace CustomerParadigmPageXmlModel;
use MagentoFrameworkEventObserver;
use MagentoFrameworkEventObserverInterface;
class Layout implements ObserverInterface {
protected $_logger;
public function __construct ( PsrLogLoggerInterface $logger ) {
$this->_logger = $logger;
}
public function execute(MagentoFrameworkEventObserver $observer) {
$log_file = BP . '/var/log/page_layout.xml';
if (file_exists($log_file)) {
unlink($log_file);
}
$xml = $observer->getEvent()->getLayout()->getXmlString();
/*$this->_logger->debug($xml);*/
$writer = new ZendLogWriterStream($log_file);
$logger = new ZendLogLogger();
$logger->addWriter($writer);
$logger->info($xml);
return $this;
}
}
Nothing too amazing going on here, and i'm sure there is plenty of room to improve (working with the built in logger is one of them) but it gets the job done for me when i'm developing a site.
add a comment |
I put together a little module that will write the XML page structure to a log file in the var/log/
folder.
app/code/CustomerParadigm/PageXml/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="CustomerParadigm_PageXml" setup_version="1.0.0" schema_version="1.0.0">
<sequence>
<module name="Magento_Catalog"/>
<module name="Magento_Theme"/>
</sequence>
</module>
</config>
app/code/CustomerParadigm/PageXml/etc/events.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="layout_generate_blocks_after">
<observer name="customerparadigm_layout_generate_blocks_after" instance="CustomerParadigmPageXmlModelLayout" />
</event>
</config>
app/code/CustomerParadigm/PageXml/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'CustomerParadigm_PageXml',
__DIR__
);
app/code/CustomerParadigm/PageXml/Model/Layout.php
<?php
namespace CustomerParadigmPageXmlModel;
use MagentoFrameworkEventObserver;
use MagentoFrameworkEventObserverInterface;
class Layout implements ObserverInterface {
protected $_logger;
public function __construct ( PsrLogLoggerInterface $logger ) {
$this->_logger = $logger;
}
public function execute(MagentoFrameworkEventObserver $observer) {
$log_file = BP . '/var/log/page_layout.xml';
if (file_exists($log_file)) {
unlink($log_file);
}
$xml = $observer->getEvent()->getLayout()->getXmlString();
/*$this->_logger->debug($xml);*/
$writer = new ZendLogWriterStream($log_file);
$logger = new ZendLogLogger();
$logger->addWriter($writer);
$logger->info($xml);
return $this;
}
}
Nothing too amazing going on here, and i'm sure there is plenty of room to improve (working with the built in logger is one of them) but it gets the job done for me when i'm developing a site.
add a comment |
I put together a little module that will write the XML page structure to a log file in the var/log/
folder.
app/code/CustomerParadigm/PageXml/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="CustomerParadigm_PageXml" setup_version="1.0.0" schema_version="1.0.0">
<sequence>
<module name="Magento_Catalog"/>
<module name="Magento_Theme"/>
</sequence>
</module>
</config>
app/code/CustomerParadigm/PageXml/etc/events.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="layout_generate_blocks_after">
<observer name="customerparadigm_layout_generate_blocks_after" instance="CustomerParadigmPageXmlModelLayout" />
</event>
</config>
app/code/CustomerParadigm/PageXml/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'CustomerParadigm_PageXml',
__DIR__
);
app/code/CustomerParadigm/PageXml/Model/Layout.php
<?php
namespace CustomerParadigmPageXmlModel;
use MagentoFrameworkEventObserver;
use MagentoFrameworkEventObserverInterface;
class Layout implements ObserverInterface {
protected $_logger;
public function __construct ( PsrLogLoggerInterface $logger ) {
$this->_logger = $logger;
}
public function execute(MagentoFrameworkEventObserver $observer) {
$log_file = BP . '/var/log/page_layout.xml';
if (file_exists($log_file)) {
unlink($log_file);
}
$xml = $observer->getEvent()->getLayout()->getXmlString();
/*$this->_logger->debug($xml);*/
$writer = new ZendLogWriterStream($log_file);
$logger = new ZendLogLogger();
$logger->addWriter($writer);
$logger->info($xml);
return $this;
}
}
Nothing too amazing going on here, and i'm sure there is plenty of room to improve (working with the built in logger is one of them) but it gets the job done for me when i'm developing a site.
I put together a little module that will write the XML page structure to a log file in the var/log/
folder.
app/code/CustomerParadigm/PageXml/etc/module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="CustomerParadigm_PageXml" setup_version="1.0.0" schema_version="1.0.0">
<sequence>
<module name="Magento_Catalog"/>
<module name="Magento_Theme"/>
</sequence>
</module>
</config>
app/code/CustomerParadigm/PageXml/etc/events.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
<event name="layout_generate_blocks_after">
<observer name="customerparadigm_layout_generate_blocks_after" instance="CustomerParadigmPageXmlModelLayout" />
</event>
</config>
app/code/CustomerParadigm/PageXml/registration.php
<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'CustomerParadigm_PageXml',
__DIR__
);
app/code/CustomerParadigm/PageXml/Model/Layout.php
<?php
namespace CustomerParadigmPageXmlModel;
use MagentoFrameworkEventObserver;
use MagentoFrameworkEventObserverInterface;
class Layout implements ObserverInterface {
protected $_logger;
public function __construct ( PsrLogLoggerInterface $logger ) {
$this->_logger = $logger;
}
public function execute(MagentoFrameworkEventObserver $observer) {
$log_file = BP . '/var/log/page_layout.xml';
if (file_exists($log_file)) {
unlink($log_file);
}
$xml = $observer->getEvent()->getLayout()->getXmlString();
/*$this->_logger->debug($xml);*/
$writer = new ZendLogWriterStream($log_file);
$logger = new ZendLogLogger();
$logger->addWriter($writer);
$logger->info($xml);
return $this;
}
}
Nothing too amazing going on here, and i'm sure there is plenty of room to improve (working with the built in logger is one of them) but it gets the job done for me when i'm developing a site.
answered Feb 28 '17 at 18:17
circlesixcirclesix
2,99721547
2,99721547
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f102260%2ffind-out-the-name-for-a-referenceblock-in-magento-2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
u can find it in XML file in base theme. if you like to remove the menu this name is
catalog.topnav
. i find it in default.xml in module Theme in base.– xanka
Feb 18 '16 at 1:26