I've faced with a problem. I have to render price input type in the customer edit form on the backend. I have found that the price component has been declared in the definition.xml like this:
<price class="Magento\Ui\Component\Form\Element\DataType\Price"/>
So, I have created own definition.xml file in the view/base/ui_component/etc/definition.xml:
<?xml version="1.0" encoding="UTF-8"?>
<components xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_definition.xsd">
<!-- Price elements -->
<price class="Magento\Ui\Component\Form\Element\DataType\Price">
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/form/element/abstract</item>
<item name="config" xsi:type="array">
<item name="template" xsi:type="string">ui/form/field</item>
<item name="elementTmpl" xsi:type="string">ui/form/element/price</item>
</item>
</item>
</argument>
</price>
</components>
Unfortunately, XSD validation avoid this change from appling and I have got the following issue:
Element 'components': Missing child element(s). Expected is one of ( tab, dataSource, paging, massaction, listing, form, fieldset, field, filters, columns ).
Line: 2
I have read the magento 2 developer guid ( http://devdocs.magento.com/guides/v2.0/ui-components/ui-component.html ) :
Any module can introduce its own set of custom components or modify initial configuration for existing components in a common to Magento way
Well, I have used "the common way", haven't I?
I would glad to read your ideas about this issue and ways in which we can reconfigurate the ui component via xml declaration.
Best Answer
Not sure if this will help so many months later, but
definition.xml
is where a UI Component's default configuration gets created. When Magento uses a particular node in aui_component/*.xml
file, it users the defaults fromdefinition.xml
. However, if yourui_component/*.xml
file/tree, you can sayand your changes in
ui_component/*.xml
will win.