sourceノードについて
source返されたデータ配列のキーにノードの値が対応する\Magento\Framework\View\Element\UiComponent\DataProvider\DataProviderInterface::getDataあなたのUIコンポーネントの方法。
たとえば、customer_form UIを考えてみましょう。
ファイル/Magento/Customer/view/base/ui_component/customer_form.xml
ここから、ほとんどのフィールドでMagento customerがsourceノードの下の値を使用していることがわかります。
ただし、フィールドaddressセットの下のフィールドについては、この値がに変更されますaddress。
次に、customer_form UIコンポーネントに対応するDataProviderを簡単に見てみましょう。
クラスはです。
\Magento\Customer\Model\Customer\DataProvider
おおまかに言って、getDataこのクラスのメソッドは、customer_formコンポーネントによって宣言された対応するフィールドに入力されるデータを返します。
あなたは今推測できるとおり、顧客の値sourceノードは、キーの下に格納された値を使用することを教えてくれる顧客にgetDataしながら、方法をアドレス sourceキーの下に格納されたデータへのポイントアドレス返されたデータインチ
よく見る:
<field name="firstname" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
item name="source" xsi:type="string">customer</item>
</item>
</argument>
</field>
上記のフィールドは、顧客のDataProviderによって返されたキー顧客の下に保存されたデータからその名の値を取得します。
以下の場合、firstname値のソースは、キーアドレスの下に保存されたデータです。
<field name="firstname" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">address</item>
</item>
</argument>
</field>
dataScopeノードについて
dataScopeノードは、あなたがのために値を変更することができます名前など、あなたの入力(フィールド)の属性を、
<field name="title">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="dataType" xsi:type="string">text</item>
<item name="formElement" xsi:type="string">input</item
<item name="dataScope" xsi:type="string">field_name</item>
</item>
</argument>
</field>
次のように結果の入力がレンダリングされます。<input name="field_name"...>
dataScopeドットで区切られたノードに値を書き込むこともできます。customer.address.firstnameこの場合、結果の入力は次のようにレンダリングされます。<input name="customer[address][firstname]"...>
ここで魔法が起こります。
また、dataScopeノードはフィールドの取得値のパスを変更します。これは、リンク手法によって実現されます。