Skip to content

Commit 24f5b57

Browse files
author
Vitaliy
authored
Merge pull request #281 from magento/89-UI-component-form-generation
82-ui component form generation MVP
2 parents 657169c + 6ad2227 commit 24f5b57

File tree

68 files changed

+4066
-45
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+4066
-45
lines changed

gradle-tasks/pmd/ruleset.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
</rule>
2525
<rule ref="category/java/design.xml">
2626
<exclude name="LawOfDemeter"/>
27+
<exclude name="DataClass"/>
2728
</rule>
2829
<rule ref="category/java/documentation.xml">
2930
<exclude name="CommentRequired" />

resources/META-INF/plugin.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
<action id="MagentoCreateAGraphQlResolver" class="com.magento.idea.magento2plugin.actions.generation.NewGraphQlResolverAction" />
6767
<action id="MagentoCreateCLICommand" class="com.magento.idea.magento2plugin.actions.generation.NewCLICommandAction" />
6868
<action id="MagentoCreateUiComponentGrid" class="com.magento.idea.magento2plugin.actions.generation.NewUiComponentGridAction" />
69+
<action id="MagentoCreateUiComponentForm" class="com.magento.idea.magento2plugin.actions.generation.NewUiComponentFormAction" />
6970
<add-to-group group-id="NewGroup" anchor="last"/>
7071
</group>
7172

@@ -202,7 +203,11 @@
202203
<internalFileTemplate name="Magento Module Cron Groups Xml"/>
203204
<internalFileTemplate name="Magento Module UI Component Grid Xml"/>
204205
<internalFileTemplate name="Magento Module Ui Grid Collection Data Provider Php"/>
205-
<internalFileTemplate name="Magento Module Ui Grid Custom Data Provider Php"/>
206+
<internalFileTemplate name="Magento Module Ui Custom Data Provider Php"/>
207+
<internalFileTemplate name="Magento Module UI Component Form Xml"/>
208+
<internalFileTemplate name="Magento Php Form Button Block Class"/>
209+
<internalFileTemplate name="Magento Routes Xml"/>
210+
<internalFileTemplate name="Magento Module Layout Xml"/>
206211

207212
<postStartupActivity implementation="com.magento.idea.magento2plugin.project.startup.CheckIfMagentoPathIsValidActivity"/>
208213
</extensions>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<field name="${NAME}" sortOrder="${SORT_ORDER}" formElement="${FORM_ELEMENT}">
2+
<argument name="data" xsi:type="array">
3+
<item name="config" xsi:type="array">
4+
<item name="source" xsi:type="string">${SOURCE}</item>
5+
</item>
6+
</argument>
7+
<settings>
8+
<dataType>${DATA_TYPE}</dataType>
9+
<label translate="true">${LABEL}</label>
10+
<dataScope>${NAME}</dataScope>
11+
</settings>
12+
</field>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!--
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<html lang="en">
8+
<body>
9+
<p face="verdana" size="-1">
10+
The <a href="https://devdocs.magento.com/guides/v2.3/ui_comp_guide/components/ui-listing-grid.html">Form component</a> configuration.
11+
</p>
12+
13+
<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse">
14+
<tr>
15+
<td colspan="3"><font face="verdana" size="-1">Template's predefined variables:</font></td>
16+
</tr>
17+
</table>
18+
</body>
19+
</html>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
return [
2+
'label' => __('${BUTTON_LABEL}'),
3+
'on_click' => sprintf("location.href = '%s';", $this->getUrl('*/*/')),
4+
'class' => 'back',
5+
'sort_order' => ${BUTTON_SORT_ORDER}
6+
];
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
return [
2+
'label' => __('${BUTTON_LABEL}'),
3+
'class' => 'delete',
4+
'on_click' => 'deleteConfirm(\'' . __(
5+
'Are you sure you want to do this?'
6+
) . '\', \'' .
7+
//TODO: adjust entity ID
8+
$this->getUrl('*/*/${BUTTON_ROUTE}', ['entity_id' => ''])
9+
. '\', {"data": {}})',
10+
'sort_order' => ${BUTTON_SORT_ORDER}
11+
];
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
return [
2+
'label' => __('${BUTTON_LABEL}'),
3+
'class' => 'save primary',
4+
'on_click' => '',
5+
'data_attribute' => [
6+
'mage-init' => [
7+
'Magento_Ui/js/form/button-adapter' => [
8+
'actions' => [
9+
[
10+
'targetName' => '${FORM_NAME}.${FORM_NAME}',
11+
'actionName' => 'save',
12+
'params' => [
13+
true,
14+
//TODO: adjust entity ID
15+
['entity_id' => ''],
16+
]
17+
]
18+
]
19+
]
20+
]
21+
]
22+
];
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)