1

I often see code like <update handle='xy' /> in layout files.

vendor\magento\module-sales\view\frontend\layout\sales_email_order_items.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" label="Email Order Items List" design_abstraction="custom">
    <update handle="sales_email_order_renderers"/>
    <update handle="sales_email_item_price"/>
    <body>
        ...
    </body>
</page>

What is the purpose of it?

1

1 Answer 1

3

The update layout directive is a way to include another layout handle in your page.
In the example you provided, in the layout sales_email_order_items the layout handles sales_email_order_renderers and sales_email_item_price are loaded.
This is useful if you have multiple pages with similar structures of blocks.
You out the common blocks structure in a separate layout file and you load it in multiple places.
This way you avoid configuration duplication.

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.