Template file (app/code/namespace/module/view/adminhtml/ui-component/product_form.xml)
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright 2013-2017 Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<argument name="data" xsi:type="array">
<item name="template" xsi:type="string">templates/collapsible2</item>
</argument>
</form>
Does not render app/code/namespace/module/view/adminhtml/ui-component/templates/collapsible2.xhtml
But if I
- Copy
vendor/magento/module-catalog/view/adminhtml/ui_component/product_form.xml - Modify the template line and make it
app/code/namespace/module/view/adminhtml/ui-component/product_form.xml, - Move or delete
vendor/magento/module-catalog/view/adminhtml/ui_component/product_form.xml
It works. If I don't move or delete the core file, I can't override the template.
2 Answers 2
UI Commponent of Extension developers cannot extend this XSD scheme and introduce new components, but can customize existing ones enter here documentation
-
I am not extending the scheme or introducing new components, though alan storm's UI component series shows you how to get around that and add your own components. I'm simply trying to change the template which they say is eligible here (even though they list some of the directory and file locations wrong): devdocs.magento.com/guides/v2.0/ui-components/ui-component.htmluser44406– user444062017年08月15日 22:09:05 +00:00Commented Aug 15, 2017 at 22:09
-
1
You are doing wrong template path
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<argument name="data" xsi:type="array">
<item name="template" xsi:type="string">templates/collapsible2</item>
</argument>
The path templates/collapsible2 should be
app/code/namespace/module/view/adminhtml/ui-component/templates/collapsible2.xhtml
in app/code/namespace/module/etc/module.xml should add depend on Magento_Ui