How are the «*.phtml» templates rendered?

I will use the standard «Contact Us» frontend form as an example.

1. The primary actors in this scenario

1.1. Magento/Contact/view/frontend/templates/form.phtml

1.2. Magento/Contact/view/frontend/layout/contact_index_index.xml

1.3. Magento\Contact\Block\ContactForm

2. The rendering process

Step 1. Magento\Framework\View\Layout::_renderBlock()


Step 2. Magento\Framework\View\Element\AbstractBlock::toHtml()

Magento 2.2

Magento 2.1.6

Step 3. Magento\Framework\View\Element\Template::_toHtml()

Details: How is Magento\Framework\View\Element\Template::getTemplateFile() implemented and used?

Step 4. Magento\Framework\View\Element\Template::fetchView()




Details:

See also: