Find out the “name” for a referenceBlock in Magento 2Hide “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

Did the DC-9 ever use RATO in revenue service?

How can I kill an app using Terminal?

What is the difference between "behavior" and "behaviour"?

A particular customize with green line and letters for subfloat

Increase performance creating Mandelbrot set in python

Are student evaluations of teaching assistants read by others in the faculty?

How to be diplomatic in refusing to write code that breaches the privacy of our users

I'm in charge of equipment buying but no one's ever happy with what I choose. How to fix this?

India just shot down a satellite from the ground. At what altitude range is the resulting debris field?

Is oxalic acid dihydrate considered a primary acid standard in analytical chemistry?

What is paid subscription needed for in Mortal Kombat 11?

How can a function with a hole (removable discontinuity) equal a function with no hole?

Is HostGator storing my password in plaintext?

How do I go from 300 unfinished/half written blog posts, to published posts?

Escape a backup date in a file name

Is there a problem with hiding "forgot password" until it's needed?

How do we know the LHC results are robust?

Gears on left are inverse to gears on right?

Class Action - which options I have?

CREATE opcode: what does it really do?

How does buying out courses with grant money work?

Trouble understanding the speech of overseas colleagues

How can we prove that any integral in the set of non-elementary integrals cannot be expressed in the form of elementary functions?

Go Pregnant or Go Home



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













10















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










share|improve this question

















  • 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
















10















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










share|improve this question

















  • 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














10












10








10


4






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










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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 is catalog.topnav. i find it in default.xml in module Theme in base.

    – xanka
    Feb 18 '16 at 1:26













  • 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








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











5 Answers
5






active

oldest

votes


















12














There are a couple of ways to do this:



  1. Guess

  2. Review Layout for Base, Blank and Luma Themes

  3. Perform IDE Searches for Class and ID Names

  4. 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






share|improve this answer























  • 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


















11














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.



:)






share|improve this answer

























  • 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


















4














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






share|improve this answer
































    4














    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++;


    ?>





    share|improve this answer

























    • 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



















    3














    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.






    share|improve this answer






















      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
      );



      );













      draft saved

      draft discarded


















      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









      12














      There are a couple of ways to do this:



      1. Guess

      2. Review Layout for Base, Blank and Luma Themes

      3. Perform IDE Searches for Class and ID Names

      4. 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






      share|improve this answer























      • 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















      12














      There are a couple of ways to do this:



      1. Guess

      2. Review Layout for Base, Blank and Luma Themes

      3. Perform IDE Searches for Class and ID Names

      4. 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






      share|improve this answer























      • 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













      12












      12








      12







      There are a couple of ways to do this:



      1. Guess

      2. Review Layout for Base, Blank and Luma Themes

      3. Perform IDE Searches for Class and ID Names

      4. 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






      share|improve this answer













      There are a couple of ways to do this:



      1. Guess

      2. Review Layout for Base, Blank and Luma Themes

      3. Perform IDE Searches for Class and ID Names

      4. 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







      share|improve this answer












      share|improve this answer



      share|improve this answer










      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

















      • 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













      11














      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.



      :)






      share|improve this answer

























      • 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















      11














      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.



      :)






      share|improve this answer

























      • 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













      11












      11








      11







      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.



      :)






      share|improve this answer















      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.



      :)







      share|improve this answer














      share|improve this answer



      share|improve this answer








      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

















      • 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











      4














      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






      share|improve this answer





























        4














        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






        share|improve this answer



























          4












          4








          4







          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






          share|improve this answer















          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







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 13 '18 at 14:48

























          answered Feb 13 '18 at 14:27









          open-ecommerce.orgopen-ecommerce.org

          285213




          285213





















              4














              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++;


              ?>





              share|improve this answer

























              • 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
















              4














              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++;


              ?>





              share|improve this answer

























              • 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














              4












              4








              4







              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++;


              ?>





              share|improve this answer















              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++;


              ?>






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited 22 secs 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


















              • 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












              3














              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.






              share|improve this answer



























                3














                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.






                share|improve this answer

























                  3












                  3








                  3







                  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.






                  share|improve this answer













                  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.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 28 '17 at 18:17









                  circlesixcirclesix

                  2,99721547




                  2,99721547



























                      draft saved

                      draft discarded
















































                      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.




                      draft saved


                      draft discarded














                      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





















































                      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







                      Popular posts from this blog

                      Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

                      Magento 2 disable Secret Key on URL's from terminal The Next CEO of Stack OverflowMagento 2 Shortcut/GUI tool to perform commandline tasks for windowsIn menu add configuration linkMagento oAuth : Generating access token and access secretMagento 2 security key issue in Third-Party API redirect URIPublic actions in admin controllersHow to Disable Cache in Custom WidgetURL Key not changing in Magento 2Product URL Key gets deleted when importing custom options - Magento 2Problem with reindex terminalMagento 2 - bin/magento Commands not working in Cpanel Terminal

                      Aasi (pallopeli) Navigointivalikko