0

I created default.xml for my module. I want to inject block into header. I tried different ways like:

<referenceContainer name="header.container" before="-"> 
<block class="Vendor\Name\Block\Block" name="myname" template="Vendor_Name::block.phtml" />
</referenceContainer>
<referenceContainer name="header.container" before="-"> 
<block class="Vendor\Name\Block\Block" name="myname" template="Vendor_Name::block.phtml" />
</referenceContainer>
<referenceContainer name="header.wrapper"> 
<block class="Vendor\Name\Block\Block" name="myname" template="Vendor_Name::block.phtml" />
</referenceContainer>

....

But it still not working. Injection my block into body (if i use name="after.body.start" working ok.

I make sure that my Module will load after Theme

<sequence>
<module name="Smartwave_Porto"/>
</sequence>

But my block is still not visible or in some cases (when i use orher names) magento do not add my block to cointeriner but emptyfied this cointerner - display empty cointeriner.

What are the the best methods to debug what exactly is going on under the hood - if i want to trace whole process of creating HTML of HTML?

SantiBM
1,39015 silver badges31 bronze badges
asked Apr 30, 2020 at 16:10

2 Answers 2

0
answered Apr 30, 2020 at 17:21
2
  • Not so much, because i already tried <referenceContainer name="header.panel"><block /></referenceContainer> but no effec in my template. Commented May 1, 2020 at 6:20
  • Right now i see that on new magento installation with luma theme this works. So there must be something that affect displaying of my block either in custom Theme or in one of Module that is installed in my magento instance. Maybe this "Mgt Developer Tool' will help to find the problem. Commented May 1, 2020 at 7:09
0

In response to your other question, I would recommend Mgt Developer Toolbar (https://www.mgt-commerce.com/documentation/magento2-mgt-developer-toolbar).

This will let you inspect all the blocks/handles etc that are getting outputted to your page.

answered Apr 30, 2020 at 23:22
1
  • I: installed mgt. I get block name from it and use like <referenceContainer name="porto_header" > <Block... atfer this whole porto_header disappear now. Commented May 4, 2020 at 6:06

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.