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
.
magento/app/code/UV/Mitgliedsnummer/etc/di.xml
<?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>
magento/app/code/UV/Mitgliedsnummer/etc/module.xml
<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">
<sequence>
<module name="Clarion_CustomAttribute" />
</sequence>
</module>
</config>
magento/app/code/UV/Mitgliedsnummer/view/frontend/layout/customer_account_create.xml
<?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">
<body>
<referenceBlock name="clarion.register">
<arguments>
<argument name="template" xsi:type="string">Clarion_CustomAttribute::view.phtml</argument>
</arguments>
</referenceBlock>
</body>
</page>
-->
magento/app/code/UV/Mitgliedsnummer/view/frontend/templates/form/register.phtml
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
template="form/register.phtml"
totemplate="UV_Mitgliedsnummer::form/register.phtml"