Skip to content

Commit 0a872ea

Browse files
committed
Fixed plugin generation sort order requirement
1 parent 1e3e171 commit 0a872ea

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

resources/fileTemplates/code/Magento Module DI Xml Plugin.xml.ft

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
<type name="${TYPE}">
33
#end
44
<plugin name="${NAME}"
5-
type="${PLUGIN_TYPE}" sortOrder="${SORT_ORDER}" />
5+
#if (${SORT_ORDER})
6+
type="${PLUGIN_TYPE}"
7+
sortOrder="${SORT_ORDER}" />
8+
#else
9+
type="${PLUGIN_TYPE}" />
10+
#end
611
#if (${TYPE})
712
</type>
813
#end

src/com/magento/idea/magento2plugin/actions/generation/dialog/CreateAPluginDialog.form

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@
131131
</grid>
132132
</constraints>
133133
<properties>
134-
<text value="10"/>
135134
<toolTipText value="Plugin sort order in di.xml"/>
136135
</properties>
137136
<clientProperties>

src/com/magento/idea/magento2plugin/actions/generation/dialog/CreateAPluginDialog.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ public class CreateAPluginDialog extends AbstractDialog {
8282
message = {DirectoryRule.MESSAGE, DIRECTORY})
8383
private JTextField pluginDirectory;
8484

85-
@FieldValidation(rule = RuleRegistry.NOT_EMPTY,
86-
message = {NotEmptyRule.MESSAGE, SORT_ORDER})
8785
@FieldValidation(rule = RuleRegistry.NUMERIC,
8886
message = {NumericRule.MESSAGE, SORT_ORDER})
8987
private JTextField pluginSortOrder;

src/com/magento/idea/magento2plugin/actions/generation/generator/PluginDiXmlGenerator.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ protected void fillAttributes(final Properties attributes) {
161161
attributes.setProperty("NAME", pluginFileData.getPluginName());
162162
attributes.setProperty("PLUGIN_TYPE", pluginFileData.getPluginFqn());
163163
attributes.setProperty("PLUGIN_NAME", pluginFileData.getPluginName());
164-
attributes.setProperty("SORT_ORDER", pluginFileData.getSortOrder());
164+
final String sortOrder = pluginFileData.getSortOrder();
165+
if (!sortOrder.isEmpty()) {
166+
attributes.setProperty("SORT_ORDER", sortOrder);
167+
}
165168
}
166169
}

0 commit comments

Comments
 (0)