Skip to content

How to render default Magento registration form in popup?

I have a button “Registration for dealer” on customer/account/create/ page that outputs a popup. My goal is to render in the popup the default customer registration form that’s fully functional.
Popup modal is created with RequireJS and works as intended.
Form’s location is vendormagentomodule-customerviewfrontendtemplatesformregister.phtml

The layout is at vendormagentomodule-customerviewfrontendlayoutcustomer_account_create.xml

This is the content of my customer_account_create.xml

<?xml version="1.0" ?>
    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <body>
            <referenceBlock name="form.additional.info">
                <block class="AlexLesson5HomeworkBlockCustomBlock" name="custom.registration.block" as="custom_registration_block" template="Alex_Lesson5Homework::dealer_registration.phtml" />
            </referenceBlock>
        </body>
    </page>

This is PHP block that returns a simple string for now:

class CustomBlock extends Template
{
    public function getContent()
    {
        return 'Dummy Content';
    }
}

I use getContent in my phtml template

<div id="modal-content">
    <?php echo $this->getContent(); ?>
</div>