0

i have overridden the Magento\Customer\Block\Form\Register block .now my new block file Webkul\Hello\Block\Form\Register

customer_account_create.xml

 <referenceContainer name="content">
            <block class="Magento\Customer\Block\Form\Register" name="customer_form_register" template="Magento_Customer::/form/register.phtml">
                <container name="form.additional.info" as="form_additional_info"/>
                <container name="customer.form.register.fields.before" as="form_fields_before" label="Form Fields Before" htmlTag="div" htmlClass="customer-form-before"/>
            </block>
            <block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml">
                <arguments>
                    <argument name="triggers" xsi:type="array">
                        <item name="registerSubmitButton" xsi:type="string">.action.submit</item>
                    </argument>
                </arguments>
            </block>
        </referenceContainer>

above code is core xml file.

what xml code i have to write to update block file of template and where i have to insert that code

i have tried this code snippet

<referenceBlock name="customer_form_register">
   <block class="Webkul\Hello\Block\Form\Register" template="Magento_Customer::/form/register.phtml" />
 </referenceBlock>

but not working

0

You need to create di.xml fiule in your module

app/code/Vendor/Modulename/etc/di.xml

add below code to this file

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
    <preference for="Magento\Customer\Block\Form\Register" type="Webkul\Hello\Block\Form\Register" />
</config>
2
  • Yeah..I have overridden the block file this di.xml.i have customer _accout_create.xml file in my custom theme folder.thats is the problem in my scenario – vijay b Feb 7 '17 at 12:06
  • you have to override core block using di.xml. Go with nit will solve your issue – Prashant Valanda Feb 7 '17 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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