How is a CMS page rendered?

Step 1. Routing

Details: How is the CMS frontend router (Magento\Cms\Controller\Router) implemented?

Step 2. Magento\Cms\Controller\Page\View::execute()

Please note that the page is instantiated using the Magento\Framework\ObjectManagerInterface::get() method, so the page is a singleton, and this object will be used later by the Magento\Cms\Block\Page block.

Step 3. Magento\Cms\Helper\Page::prepareResultPage(). Loading the page from the database.

Step 4. Creating the resulting instance of Magento\Framework\View\Result\Page

Step 4.1. Magento\Framework\View\Result\PageFactory::create()

Step 5. Magento\Cms\Helper\Page::setLayoutType()

Step 6. Layout handles setup

Step 7. The layout building.

This code looks like just the page_content_heading block setup (this block is not used for the «About us» page), but really any call for the Magento\Framework\View\Layout::getBlock() method builds the layout (if it is not yet built):

Step 8. Magento\Cms\Block\Page::__construct()

The $page is the singleton was created on the Step 2.

Step 9. Magento\Cms\Block\Page::_prepareLayout()

Step 10. Magento\Cms\Block\Page::_addBreadcrumbs()

Step 11. Magento\Cms\Controller\Page\View::execute() finish

Step 12. Magento\Framework\App\Action\Action::dispatch() finish

Step 13. Magento\Framework\App\FrontController::dispatch() finish

Step 14. Returning to Magento\Framework\App\Http::launch(). Starting the page rendering

Step 15. Magento\Framework\View\Result\Layout::renderResult()

Step 16. Magento\Framework\View\Result\Page::render()

Step 17. Magento_Cms/view/frontend/layout/cms_page_view.xml

Step 18. Magento\Cms\Block\Page::_toHtml()

The block was constructed on the Step 8.

See also: