I want to insert a custom block into the $block->getChildHtml('customer.form.register.extra')
placeholder in the customer registration form - called in the Magento_Customer::form/register.phtml
template file.
I have a custom block in my module that I'd like to insert into this placeholder to avoid overriding the .phtml
file.
I've copied the customer_account_create.xml
layout file into my module and replaced the code with the following:
<?xml version="1.0" encoding="UTF-8"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="customer.form.register.extra">
<block class="Magento\Framework\View\Element\Template"
name="custom.block.name"
template="Vendor_ModuleName::my_custom_template.phtml"/>
</referenceContainer>
</body>
</page>
I've also tried referencing by referenceBlock instead of referenceContainer but still my custom html is not appearing in the form.
Does anyone have any ideas how I can get this to work? Any help would be appreciated.
Thanks