1

In my theme's header.phtml, it makes a call to getChildHtml('header.links'). I am at a total loss as to where header.links exists. I need to modify that file.

Firstly, is it a phtml file, or a block in the backend?

Secondly, what method can I employ to consistently discover where the content of the call resides?

Finally, does the dot notation (e.g., 'one.two') affect which block is being called, and if so, how?enter image description here

1 Answer 1

2

The child-html of (pretty much) any block can be found by looking through layout XML. It can also be added/modified through the Block classes that you mentioned, but that doesn't help with this case, so I digress.

The actual location of the file may vary based on your theme and if you have overridden the default settings, but for the magento-luma theme, the file is located under magento/theme-frontend-luma/Magento_Theme/layout/default.xml, where you will find <block class="Magento\Framework\View\Element\Html\Links" name="header.links"> on line 11.

For many blocks, the output is controlled through the template (.phtml) file that would be defined in this line, but seeing as no template is assigned, the output generated is controlled through the Magento\Framework\View\Element\Html\Links class, found in vendor/magento/framework/View/Element/Html/Links.php. I hope this helps!

1
  • Thank you! We were able to view Links.php, and from there figure out which blocks were calling what.
    – AdamJSim
    Commented May 11, 2018 at 14:07

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.