I am currently trying to override a register.phml from a custom module in my own custom module.

My modules name is UV_Mitgliedsnummer, the custom module I want to override the template from is Clarion_CustomAttribute.


<?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
        <preference for="Magento\Customer\Block\Form\Register" type="Vendor\Module\Block\Form\Register" />


<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="UV_Mitgliedsnummer" setup_version="1.1.0">
            <module name="Clarion_CustomAttribute" />


<?xml version="1.0"?>
<block class="Magento\Customer\Block\Form\Register" as="virtual" template="form/register.phtml">

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceBlock name="clarion.register">
                <argument name="template" xsi:type="string">Clarion_CustomAttribute::view.phtml</argument>


Ich bin ein Test. :-)

Do you have any suggestions why it is not working? Thanks :-)

Edit: It seems to work now but I get these exceptions.

Exception #0 (Magento\Framework\Exception\LocalizedException): Ungültiger Block-Typ: Magento\Customer\Block\Form\Register

Exception #1 (ReflectionException): Class Vendor\Module\Block\Form\Register does not exist
  • in layout file try changing template="form/register.phtml" to template="UV_Mitgliedsnummer::form/register.phtml"
    – Piyush
    Feb 27, 2018 at 10:12
  • You have not added Block file with class you have defined for your template in xml Or you have assigned wrong class name in xml
    – Piyush
    Feb 27, 2018 at 10:25
  • Sorry I am new to Magento. Can you describe more detailled and which files you mean? Thanks so far ! Feb 27, 2018 at 10:40

1 Answer 1


You can use below code in xml file to override template

<referenceBlock name="block-name">
    <action method="setTemplate">
        <argument name="template" xsi:type="string">UV_Mitgliedsnummer::form/register.phtml</argument>

Note: Change "block-name" as per your modules layout structure

  • How can I find the block name? Clarion_CustomAttributes is a custom module. When I turn dev mode on, it shows me this as block: Magento\Customer\Block\Form\Register Feb 27, 2018 at 11:06
  • it will be there in the Clarion_CustomAttribute module's xml file which your are overriding
    – Piyush
    Feb 27, 2018 at 11:07
  • <code> <?xml version="1.0"?> <referenceBlock name="customer_form_register"> <action method="setTemplate"> <argument name="template" xsi:type="string">UV_Mitgliedsnummer::form/register.phtml</argument> </action> </referenceBlock> </code> doesn't work :-/ Feb 27, 2018 at 11:23
  • The module xml I am overriding is overriding some module too. It is also referencing to "customer_form_register". May that be the problem? Feb 27, 2018 at 11:33
  • <page xmlns:xsi="w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceBlock name="customer_form_register"> <action method='setTemplate'> <argument name='template' xsi:type='string'>Clarion_CustomerAttribute::form/register.phtml</argument> </action> </referenceBlock> </body> </page> Feb 27, 2018 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.