2
<?php echo $block->getChildHtml('control_buttons');?>

Found in

module-wishlist/view/frontend/templates/view.phtml

What is it calling? In the dev tools inspector I see some static content loading like this:

pub/static/version1498583309/frontend/Magento/luma/en_US/Magento_Ui/templates/collection.html

But there is not version folder in the directory!. So where is all the static HTML templates? pub/static/frontend/Magento/Luma... contains some static js and HTML but not what I'm looking for.

1

The call to $block->getChildHtml() in any template is a call to the xml block or container that is associated with that block class. In this case, it is making a call to a container in vendor/magento/module-wishlist/view/frontend/layout/wishlist_index_index.xml

<container name="customer.wishlist.buttons" as="control_buttons" label="Wishlist Control Buttons">
    <block class="Magento\Wishlist\Block\Customer\Wishlist\Button" name="customer.wishlist.button.update" template="button/update.phtml" cacheable="false"/>
    <block class="Magento\Wishlist\Block\Customer\Wishlist\Button" name="customer.wishlist.button.share" template="button/share.phtml" cacheable="false"/>
    <block class="Magento\Wishlist\Block\Customer\Wishlist\Button" name="customer.wishlist.button.toCart" template="button/tocart.phtml" cacheable="false"/>
</container>

The naming convention is to use the as="{{name}}" as the shorthand for the $block->getChildHtml() to use to render the container. When you have a block or container in a xml file, that element will only be rendered if the block class extends from Magento\Framework\View\Element\Template class, otherwise it has to be explicitly called in a template.

In your case, this call is getting other templates that extend from the Magento\Framework\View\Element\Template class and displaying them in that area.

Because this is php rendering these elements, your inspector is not going to help you chase down the correct info for what is displaying and where. When you run into this, you can just search the module you are in with grep -r "control_buttons" . and it will give you a list of uses for that tag. in this case, it get:

./view/frontend/layout/wishlist_index_index.xml: <container name="customer.wishlist.buttons" as="control_buttons" label="Wishlist Control Buttons">
./view/frontend/templates/view.phtml: <?php echo $block->getChildHtml('control_buttons');?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy