- Installed clear magento 2.3.2
- Created simple custom theme which contain (
theme.xml
,registration.php
andCustomTheme/Magento_Customer/layout/customer_account_create.xml
). - Also I created a simple extension which add a custom field to customer accout create form (This extension also use
customer_account_create.xml
).
<body>
<referenceContainer name="form.additional.info">
<block class="CompanyNameModuleNameBlockTest" name="test"
template="CompanyName_ModuleName::form/test.phtml"/>
</referenceContainer>
</body>
After that I got strange behavior:
If my CustomTheme/Magento_Customer/layout/customer_account_create.xml
as is like original file from core, non-standard field is added to the form without problems from my custom extension.
But if I will modify my file CustomTheme/Magento_Customer/layout/customer_account_create.xml
(for example I just added this string to remove minicart: `).
My non-standard field does not apply to the form
Everything looks as if I modify the layout for my needs in custom theme (delete some elements from the registration page), then all other custom extension that use this layout or reference to this layout will stop working.
2
Answers
I figured out this issue. Me helped this sections of the documentation https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/layouts/layout-extend.html https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/layouts/layout-override.html
https://devdocs.magento.com/guides/v2.3/frontend-dev-guide/layouts/layout-override.html
I think you need to read a little more the concepts and process of development of your own custom theme before doing any big modifications, at the end you will have a really bad outcome and not sustainable code.