Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit d092573

Browse files
authored
Merge pull request #6872 from serhiyzhovnir/add-documentation-for-FormDataProvider-UI-component
Added the documentation for the FormDataProvider UI component
2 parents 658b915 + 7b1bfef commit d092573

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

src/_data/toc/ui-components-guide.yml

+3
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ pages:
103103
- label: Form component
104104
url: /ui_comp_guide/components/ui-form.html
105105

106+
- label: FormDataProvider component
107+
url: /ui_comp_guide/components/ui-form-data-provider.html
108+
106109
- label: GridDataProvider component
107110
url: /ui_comp_guide/components/ui-grid-data-provider.html
108111

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
group: ui-components-guide
3+
title: FormDataProvider component
4+
contributor_name: Atwix
5+
contributor_link: https://www.atwix.com/
6+
---
7+
8+
The FormDataProvider [UI component](https://glossary.magento.com/ui-component) is a data provider for the [Form]({{ page.baseurl }}/ui_comp_guide/components/ui-form.html) component. It stores form data in a specific format that is shared among all UI components in the scope of [Form]({{ page.baseurl }}/ui_comp_guide/components/ui-form.html) component and provides the functionality for submitting the data.
9+
10+
## Configuration options
11+
12+
| Option | Description | Type | Default Value |
13+
| --- | --- | --- | --- |
14+
| `class` | Path to the [PHP](https://glossary.magento.com/php) class responsible for the [backend](https://glossary.magento.com/backend) implementation of the component | String | `Magento\Framework\View\Element\UiComponent\DataProvider\DataProvider` |
15+
| `component` | The path to the component's `.js` file, relative to RequireJS. | String | `Magento_Ui/js/form/provider` |
16+
| `clientConfig` | Configuration of the [FormClient]({{ site.mage2bloburl }}/{{page.guide_version}}/app/code/Magento/Ui/view/base/web/js/form/client.js) component. | Object | `urls: {save: '${ $.submit_url }',beforeSave: '${ $.validate_url }'}` |
17+
| `submit_url` | Path to controller that will process the form data submitting request. | String | `-` |
18+
| `validate_url` | Path to controller that will process the form data validation request. | String | `-` |
19+
20+
## Sources files
21+
22+
Extends [`UiElement`]({{ page.baseurl }}/ui_comp_guide/concepts/ui_comp_uielement_concept.html):
23+
24+
- [app/code/Magento/Ui/view/base/web/js/form/provider.js]({{ site.mage2bloburl }}/{{page.guide_version}}/app/code/Magento/Ui/view/base/web/js/form/provider.js)
25+
26+
## Examples
27+
28+
### Integrate the FormDataProvider component with the Form component
29+
30+
This is an example of how the FormDataProvider component integrates with the [Form]({{ page.baseurl }}/ui_comp_guide/components/ui-form.html) component:
31+
32+
```xml
33+
<form>
34+
<dataSource name="sales_rule_form_data_source">
35+
<argument name="data" xsi:type="array">
36+
<item name="js_config" xsi:type="array">
37+
<item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>
38+
</item>
39+
</argument>
40+
<settings>
41+
<submitUrl path="path/to/submit_form_data_controller"/>
42+
<validateUrl path="path/to/validate_form_data_controller"/>
43+
</settings>
44+
</dataSource>
45+
</form>
46+
```

0 commit comments

Comments
 (0)