Skip to content

Commit

Permalink
Update docs for widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
graschik committed Nov 28, 2022
1 parent 9c5b75b commit e1ff41e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/widgets/using-ui-components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ You can see an example of a widget with most of the available UI components. The

## How to use it?
- Create [app/code/Vendor/Module/etc/widget.xml](../../../etc/widget.xml) file inside your module.
- Create a widget class that will extend from ```Grasch\AdminUi\Block\Widget\AbstractWidget```.
- You have to add only one parameter ```block``` with class ```Grasch\AdminUi\Block\Adminhtml\Widget\Ui\Components```.
- ```namespace``` is the name of your form.xml file.
```xml
Expand All @@ -27,3 +28,17 @@ You can see an example of a widget with most of the available UI components. The
```
- 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.
- Use this class ```Grasch\AdminUi\DataProvider\Widget\DataProvider``` as ```dataProvider``` for your form.
- Get data from a widget.
```php
/**
* @return string
*/
protected function _toHtml(): string
{
$data = $this->getData('component_data');
print_r($data);

return '';
}
```
![](result.png)
Binary file added docs/widgets/using-ui-components/result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e1ff41e

Please sign in to comment.