Skip to content

Commit 5a855c8

Browse files
author
Vitaliy Boyko
committed
89: added controller and data provider
1 parent ec99e3e commit 5a855c8

25 files changed

+929
-190
lines changed

resources/META-INF/plugin.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,11 @@
203203
<internalFileTemplate name="Magento Module Cron Groups Xml"/>
204204
<internalFileTemplate name="Magento Module UI Component Grid Xml"/>
205205
<internalFileTemplate name="Magento Module Ui Grid Collection Data Provider Php"/>
206-
<internalFileTemplate name="Magento Module Ui Grid Custom Data Provider Php"/>
206+
<internalFileTemplate name="Magento Module Ui Custom Data Provider Php"/>
207207
<internalFileTemplate name="Magento Module UI Component Form Xml"/>
208208
<internalFileTemplate name="Magento Php Form Button Block Class"/>
209+
<internalFileTemplate name="Magento Routes Xml"/>
210+
<internalFileTemplate name="Magento Module Layout Xml"/>
209211

210212
<postStartupActivity implementation="com.magento.idea.magento2plugin.project.startup.CheckIfMagentoPathIsValidActivity"/>
211213
</extensions>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
2+
<body>
3+
</body>
4+
</page>

resources/fileTemplates/internal/Magento Module Layout Xml.xml.html

Whitespace-only changes.

resources/fileTemplates/internal/Magento Module UI Component Form Xml.xml.ft

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
</settings>
1919
<dataSource name="${NAME}_data_source" component="Magento_Ui/js/form/provider">
2020
<settings>
21-
<submitUrl path="customerquote/CustomerQuoteVersion/save"/>
21+
<submitUrl path="${ROUTE}/${SUBMIT_CONTROLLER}/${SUBMIT_ACTION}"/>
2222
</settings>
23-
<dataProvider class="Atwix\CustomerQuotes\Ui\Component\CustomerQuoteVersion\Form\DataProvider\CustomerQuoteVersionDataProvider" name="${NAME}_data_source"/>
23+
<dataProvider class="${DATA_PROVIDER}" name="${NAME}_data_source"/>
2424
</dataSource>
2525
</form>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
package com.magento.idea.magento2plugin.actions.generation.data;
7+
8+
public class LayoutXmlData {
9+
private String area;
10+
private String route;
11+
private String moduleName;
12+
private String controllerName;
13+
private String actionName;
14+
private String formName;
15+
16+
/**
17+
* Routes XML Data.
18+
*
19+
* @param area String
20+
* @param route String
21+
*/
22+
public LayoutXmlData(
23+
String area,
24+
String route,
25+
String moduleName,
26+
String controllerName,
27+
String actionName,
28+
String formName
29+
) {
30+
this.area = area;
31+
this.route = route;
32+
this.moduleName = moduleName;
33+
this.controllerName = controllerName;
34+
this.actionName = actionName;
35+
this.formName = formName;
36+
}
37+
38+
public String getArea() {
39+
return area;
40+
}
41+
42+
public String getRoute() {
43+
return route;
44+
}
45+
46+
public String getModuleName() {
47+
return moduleName;
48+
}
49+
50+
public String getControllerName() {
51+
return controllerName;
52+
}
53+
54+
public String getActionName() {
55+
return actionName;
56+
}
57+
58+
public String getFormName() {
59+
return formName;
60+
}
61+
}

src/com/magento/idea/magento2plugin/actions/generation/data/RoutesXmlData.java

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,43 +9,34 @@
99

1010
public class RoutesXmlData {
1111
private String area;
12-
private String routerId;
1312
private String route;
14-
private boolean isAdminhtml;
13+
private String moduleName;
1514

1615
/**
1716
* Routes XML Data.
1817
*
1918
* @param area String
20-
* @param routerId String
2119
* @param route String
22-
* @param isAdminhtml boolean
2320
*/
2421
public RoutesXmlData(
2522
String area,
26-
String routerId,
2723
String route,
28-
boolean isAdminhtml
24+
String moduleName
2925
) {
3026
this.area = area;
31-
this.routerId = routerId;
3227
this.route = route;
33-
this.isAdminhtml = isAdminhtml;
28+
this.moduleName = moduleName;
3429
}
3530

3631
public String getArea() {
3732
return area;
3833
}
3934

40-
public String getRouterId() {
41-
return routerId;
42-
}
43-
4435
public String getRoute() {
4536
return route;
4637
}
4738

48-
public boolean isAdminhtml() {
49-
return isAdminhtml;
39+
public String getModuleName() {
40+
return moduleName;
5041
}
5142
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
package com.magento.idea.magento2plugin.actions.generation.data;
77

88
@SuppressWarnings({"PMD.DataClass"})
9-
public class UiComponentGridDataProviderData {
9+
public class UiComponentDataProviderData {
1010
private final String type;
1111
private final String name;
1212
private final String namespace;
@@ -22,7 +22,7 @@ public class UiComponentGridDataProviderData {
2222
* @param path String
2323
* @param collectionFqn String
2424
*/
25-
public UiComponentGridDataProviderData(
25+
public UiComponentDataProviderData(
2626
final String type,
2727
final String name,
2828
final String namespace,

src/com/magento/idea/magento2plugin/actions/generation/data/UiComponentFormFileData.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ public class UiComponentFormFileData {
1717
private final ArrayList<UiComponentFormFieldsetData> fieldsets;
1818
private final ArrayList<UiComponentFormFieldData> fields;
1919
private String route;
20+
private String submitControllerName;
21+
private String submitActionName;
22+
private String dataProviderFqn;
2023

2124
/**
2225
* UI Form data file constructor.
@@ -36,7 +39,10 @@ public UiComponentFormFileData(
3639
final ArrayList<UiComponentFormButtonData> buttons,
3740
final ArrayList<UiComponentFormFieldsetData> fieldsets,
3841
final ArrayList<UiComponentFormFieldData> fields,
39-
final String route
42+
final String route,
43+
String submitControllerName,
44+
String submitActionName,
45+
String dataProviderFqn
4046
) {
4147
this.formName = formName;
4248
this.formArea = formArea;
@@ -46,6 +52,9 @@ public UiComponentFormFileData(
4652
this.fieldsets = fieldsets;
4753
this.fields = fields;
4854
this.route = route;
55+
this.submitControllerName = submitControllerName;
56+
this.submitActionName = submitActionName;
57+
this.dataProviderFqn = dataProviderFqn;
4958
}
5059

5160
/**
@@ -114,4 +123,16 @@ public ArrayList<UiComponentFormFieldData> getFields() {
114123
public String getRoute() {
115124
return route;
116125
}
126+
127+
public String getSubmitControllerName() {
128+
return submitControllerName;
129+
}
130+
131+
public String getSubmitActionName() {
132+
return submitActionName;
133+
}
134+
135+
public String getDataProviderFqn() {
136+
return dataProviderFqn;
137+
}
117138
}

0 commit comments

Comments
 (0)