1

I need to override a template file \Magento\Customer\view\frontend\templates\form\register.phtml in my custom module.

According to Magento's document. I know that creating a custom theme module can fit my need, but I want to know other than creating a custom theme module, are there some other methods for overriding a template file?

Thanks in advance.

1 Answer 1

3

You have to override the customer module to customize the register template. You have to create the new custom module and inside that module's etc/module.xml file, you have to set:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Package_Module" setup_version="2.0.1">
        <sequence>
            <module name="Magento_Customer"/>
        </sequence>
    </module>
</config>
4
  • 1
    Hi Rocky, could you explain a little more about what this is doing and why it's needed?
    – scrowler
    Commented Dec 16, 2015 at 21:02
  • if you want to override contact module form.phtml, you have to create new custom module and inside module root etc/module.xml file you have to define your core module name inside sequence tag. Its useful for override core module template.
    – user32787
    Commented Dec 17, 2015 at 11:22
  • That gives no more information than your answer did. What does the sequence tag do and how does it work?
    – scrowler
    Commented Dec 17, 2015 at 17:51
  • <sequence> element in the module.xml file is used to define the load order of dependencies.you can getting more info about sequence tag from devdocs.magento.com/guides/v2.0/architecture/modules/…
    – user32787
    Commented Dec 18, 2015 at 5:19

Your Answer

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

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