不正确的Magento 2布局覆盖行为 已安装的透明magento 2.3.2 创建了包含(theme.xml、registration.php和CustomTheme/Magento\u Customer/layout/Customer\u account\u create.xml)的简单自定义主题 我还创建了一个简单的扩展,它向customer account创建表单添加了一个自定义字段(此扩展还使用customer\u account\u create.xml)

不正确的Magento 2布局覆盖行为 已安装的透明magento 2.3.2 创建了包含(theme.xml、registration.php和CustomTheme/Magento\u Customer/layout/Customer\u account\u create.xml)的简单自定义主题 我还创建了一个简单的扩展,它向customer account创建表单添加了一个自定义字段(此扩展还使用customer\u account\u create.xml),magento,layout,magento2,Magento,Layout,Magento2,之后我有了奇怪的行为: 如果我的CustomTheme/Magento\u Customer/layout/Customer\u account\u create.xml与core中的原始文件类似,则非标准字段会添加到表单中,而我的自定义扩展名不会出现问题 但是如果我要修改我的文件CustomTheme/Magento\u Customer/layout/Customer\u account\u create.xml(例如,我刚刚添加了这个字符串以删除minicart:`)。 我的非标准字段不适

之后我有了奇怪的行为: 如果我的
CustomTheme/Magento\u Customer/layout/Customer\u account\u create.xml
与core中的原始文件类似,则非标准字段会添加到表单中,而我的自定义扩展名不会出现问题

但是如果我要修改我的文件
CustomTheme/Magento\u Customer/layout/Customer\u account\u create.xml
(例如,我刚刚添加了这个字符串以删除minicart:`)。 我的非标准字段不适用于表单

一切看起来都像是我在自定义主题中根据自己的需要修改了布局(从注册页面删除一些元素),那么使用此布局或引用此布局的所有其他自定义扩展都将停止工作。

我认为,在进行任何大的修改之前,您需要多读一点自定义主题的概念和开发过程,最终您会有一个非常糟糕的结果,而且代码不可持续。

我解决了这个问题。 我帮助完成了文档的这一部分

我发现了这一点
<body>
   <referenceContainer name="form.additional.info">
       <block class="CompanyName\ModuleName\Block\Test" name="test"
              template="CompanyName_ModuleName::form/test.phtml"/>
   </referenceContainer>
</body>