magento2 – Pass Order Data from Admin Email Template to Block?

I advise to check how Magento is dealing with this for a specific email: the order email is a great one. To understand this example, I suggest some steps:

step1: Open the file, vendor/magento/theme-frontend-luma/Magento_Sales/email/order_new.html.

In this file, the line {{layout handle="sales_email_order_items" order=$order area="frontend"}} replicates what you are trying to do.

the part handle="sales_email_order_items" means we use a layout file that I invite you to open

step 2: open the file vendor/magento/module-sales/view/frontend/layout/sales_email_order_items.xml

within this layout file, you may see we don’t have the variable order mentioned. I suggest to delve in the line <block class="MagentoSalesBlockOrderEmailItems" name="items" template="Magento_Sales::email/items.phtml" cacheable="false">

within the block line, the part template="Magento_Sales::email/items.phtml" means the file is located in the module Magento_sales and in the folder view/frontend/templates/email/items.phtml

step 3: open the template file for the block /vendor/magento/module-sales/view/frontend/templates/email/items.phtml

at the top of this file, we have the line <?php $_order = $block->getOrder() ?>

and hopefully now, the whole thing makes sense to you