Skip to content

Commit e1ff41e

Browse files
author
graschik
committed
Update docs for widgets
1 parent 9c5b75b commit e1ff41e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

docs/widgets/using-ui-components/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ You can see an example of a widget with most of the available UI components. The
1212

1313
## How to use it?
1414
- Create [app/code/Vendor/Module/etc/widget.xml](../../../etc/widget.xml) file inside your module.
15+
- Create a widget class that will extend from ```Grasch\AdminUi\Block\Widget\AbstractWidget```.
1516
- You have to add only one parameter ```block``` with class ```Grasch\AdminUi\Block\Adminhtml\Widget\Ui\Components```.
1617
- ```namespace``` is the name of your form.xml file.
1718
```xml
@@ -27,3 +28,17 @@ You can see an example of a widget with most of the available UI components. The
2728
```
2829
- Create [app/code/Vendor/Module/view/adminhtml/ui_component/form.xml](../../../view/adminhtml/ui_component/widget_example_form.xml) file inside your module. Add the UI Components that you need here.
2930
- Use this class ```Grasch\AdminUi\DataProvider\Widget\DataProvider``` as ```dataProvider``` for your form.
31+
- Get data from a widget.
32+
```php
33+
/**
34+
* @return string
35+
*/
36+
protected function _toHtml(): string
37+
{
38+
$data = $this->getData('component_data');
39+
print_r($data);
40+
41+
return '';
42+
}
43+
```
44+
![](result.png)
263 KB
Loading

0 commit comments

Comments
 (0)