Skip to content

Commit d98b37b

Browse files
author
Vitaliy
authored
Merge branch '1.0.0-develop' into 92-tests-on-php-class-completion-for-the-source-model
2 parents b349275 + ef1ada0 commit d98b37b

File tree

79 files changed

+3337
-137
lines changed

Some content is hidden

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

79 files changed

+3337
-137
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
* Create a Plugin class for a class public method action
1414
* Code Inspection: Warning regarding Cacheable false attribute in default XML
1515
* Create a Preference for a class action
16+
* Create a Block action
17+
* Line markers for navigation from a plugin class to a target class
1618

1719
0.3.0
1820
=============

resources/META-INF/plugin.xml

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
title="CHANGELOG.md"
2222
>here</a>
2323
]]>
24-
2524
</change-notes>
2625

2726
<!-- please see http://confluence.jetbrains.com/display/IDEADEV/Build+Number+Ranges for description -->
@@ -38,6 +37,7 @@
3837
<depends optional="true" config-file="withJsGraphQl.xml">com.intellij.lang.jsgraphql</depends>
3938

4039
<actions>
40+
<!-- In editor generators -->
4141
<group id="MagentoGenerateGroup">
4242
<action id="MagentoGenerateBeforeMethodAction"
4343
class="com.magento.idea.magento2plugin.actions.generation.PluginGenerateBeforeMethodAction"
@@ -53,16 +53,29 @@
5353
description="Create Magento around plugin method."/>
5454
<add-to-group group-id="PhpGenerateGroup" anchor="last"/>
5555
</group>
56+
57+
<!-- Module file generators -->
58+
<group id="MagentoNewModuleFileGroup" class="com.magento.idea.magento2plugin.actions.groups.NewModuleFileGroup" text="Module File" popup="true">
59+
<action id="MagentoCreateABlock" class="com.magento.idea.magento2plugin.actions.generation.NewBlockAction" />
60+
<action id="MagentoCreateAViewModel" class="com.magento.idea.magento2plugin.actions.generation.NewViewModelAction" />
61+
<add-to-group group-id="NewGroup" anchor="last"/>
62+
</group>
63+
64+
<!-- Complex generators -->
5665
<group id="MagentoNewGroup">
5766
<action id="Magento2NewModule" class="com.magento.idea.magento2plugin.actions.generation.NewModuleAction"/>
5867
<add-to-group group-id="NewGroup" anchor="after" relative-to-action="NewDir"/>
5968
</group>
69+
<action id="MagentoCreateAnObserver.Menu" class="com.magento.idea.magento2plugin.actions.generation.CreateAnObserverAction">
70+
<add-to-group group-id="EditorPopupMenu"/>
71+
</action>
6072
<action id="MagentoCreateAPlugin.Menu" class="com.magento.idea.magento2plugin.actions.generation.CreateAPluginAction">
6173
<add-to-group group-id="EditorPopupMenu"/>
6274
</action>
6375
<action id="OverrideClassByAPreference.Menu" class="com.magento.idea.magento2plugin.actions.generation.OverrideClassByAPreferenceAction">
6476
<add-to-group group-id="EditorPopupMenu"/>
6577
</action>
78+
6679
</actions>
6780

6881
<extensions defaultExtensionNs="com.intellij">
@@ -100,6 +113,7 @@
100113
<fileBasedIndex implementation="com.magento.idea.magento2plugin.stubs.indexes.js.MagentoLibJsIndex" />
101114

102115
<codeInsight.lineMarkerProvider language="PHP" implementationClass="com.magento.idea.magento2plugin.php.linemarker.PluginLineMarkerProvider"/>
116+
<codeInsight.lineMarkerProvider language="PHP" implementationClass="com.magento.idea.magento2plugin.php.linemarker.PluginTargetLineMarkerProvider"/>
103117
<codeInsight.lineMarkerProvider language="PHP" implementationClass="com.magento.idea.magento2plugin.php.linemarker.ClassConfigurationLineMarkerProvider"/>
104118
<codeInsight.lineMarkerProvider language="PHP" implementationClass="com.magento.idea.magento2plugin.php.linemarker.WebApiLineMarkerProvider"/>
105119

@@ -134,18 +148,9 @@
134148
<internalFileTemplate name="Magento Module Xml"/>
135149
<internalFileTemplate name="Magento Module DI Xml"/>
136150
<internalFileTemplate name="Magento Php Preference Class"/>
151+
<internalFileTemplate name="Magento Module Common Php Class"/>
152+
<internalFileTemplate name="Magento Observer Class"/>
153+
<internalFileTemplate name="Magento Module Events Xml"/>
137154
</extensions>
138155

139-
<application-components>
140-
<!-- Add your application components here -->
141-
</application-components>
142-
143-
<project-components>
144-
<!-- Add your project components here -->
145-
</project-components>
146-
147-
<actions>
148-
<!-- Add your actions here -->
149-
</actions>
150-
151156
</idea-plugin>

resources/META-INF/withJsGraphQl.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,11 @@
33
<fileBasedIndex implementation="com.magento.idea.magento2plugin.stubs.indexes.graphql.GraphQlResolverIndex" />
44
<codeInsight.lineMarkerProvider language="PHP" implementationClass="com.magento.idea.magento2plugin.php.linemarker.GraphQlResolverUsageLineMarkerProvider"/>
55
<codeInsight.lineMarkerProvider language="GraphQL" implementationClass="com.magento.idea.magento2plugin.graphql.linemarker.GraphQlResolverClassLineMarkerProvider"/>
6+
<localInspection language="PHP" groupPath="PHP"
7+
shortName="GraphQlResolverInspection" displayName="Graphql must implements ResolverInterface"
8+
groupName="Magento 2"
9+
enabledByDefault="true"
10+
level="ERROR"
11+
implementationClass="com.magento.idea.magento2plugin.inspections.php.GraphQlResolverInspection"/>
612
</extensions>
713
</idea-plugin>

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

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,53 @@
55
*/
66
-->
77
<html>
8-
<body>
9-
</body>
8+
<body>
9+
<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse">
10+
<tr>
11+
<td><font face="verdana" size="-1">
12+
A plugin is a class that modifies the behavior of public class functions by intercepting a function
13+
call and running code before, after, or around that function call. This allows you to substitute or
14+
extend the behavior of original, public methods for any class or interface.
15+
</font><br>
16+
</td>
17+
</tr>
18+
<tr>
19+
<td><font face="verdana" size="-1">
20+
A plugin is declared (registered) for a class in the di.xml file.
21+
</font><br>
22+
</td>
23+
</tr>
24+
<tr>
25+
<td><font face="verdana" size="-1">
26+
<a href="https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html">Read more</a> about Plugins, including when those can be used.
27+
</font><br>
28+
</td>
29+
</tr>
30+
</table>
31+
<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse">
32+
<tr>
33+
<td colspan="3"><font face="verdana" size="-1">Predefined variables explanation:</font></td>
34+
</tr>
35+
<tr>
36+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${TYPE}</b></font></nobr></td>
37+
<td width="10">&nbsp;</td>
38+
<td width="100%" valign="top"><font face="verdana" size="-1">A PHP class or interface which the plugin observes.</font></td>
39+
</tr>
40+
<tr>
41+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${NAME}</b></font></nobr></td>
42+
<td width="10">&nbsp;</td>
43+
<td width="100%" valign="top"><font face="verdana" size="-1">An arbitrary plugin name that identifies a plugin. Also used to merge the configurations for the plugin.</font></td>
44+
</tr>
45+
<tr>
46+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${PLUGIN_TYPE}</b></font></nobr></td>
47+
<td width="10">&nbsp;</td>
48+
<td width="100%" valign="top"><font face="verdana" size="-1">The name of a plugin’s class or its virtual type.</font></td>
49+
</tr>
50+
<tr>
51+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${SORT_ORDER}</b></font></nobr></td>
52+
<td width="10">&nbsp;</td>
53+
<td width="100%" valign="top"><font face="verdana" size="-1">The order the plugin is executed when there are multiple plugins calling the same adjusted method.</font></td>
54+
</tr>
55+
</table>
56+
</body>
1057
</html>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<preference for="${FOR}" type="${TYPE}" />
1+
<preference for="${FOR}" type="${TYPE}" />

resources/fileTemplates/code/Magento Module DI Xml Preference.xml.html

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,36 @@
66
-->
77
<html>
88
<body>
9+
<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse">
10+
<tr>
11+
<td><font face="verdana" size="-1">
12+
The object manager uses abstraction-implementation mappings when the constructor signature of a class requests
13+
an object by its interface. The object manager uses these mappings to determine what the default implementation
14+
is for that class for a particular scope.
15+
</font><br>
16+
</td>
17+
</tr>
18+
<tr>
19+
<td><font face="verdana" size="-1">
20+
If you want to override a public or protected method from a core class, utilize the preference node from di.xml to achieve it.
21+
</font><br>
22+
</td>
23+
</tr>
24+
</table>
25+
<table width="100%" border="0" cellpadding="5" cellspacing="0" style="border-collapse: collapse">
26+
<tr>
27+
<td colspan="3"><font face="verdana" size="-1">Predefined variables will take the following values:</font></td>
28+
</tr>
29+
<tr>
30+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${FOR}</b></font></nobr></td>
31+
<td width="10">&nbsp;</td>
32+
<td width="100%" valign="top"><font face="verdana" size="-1">Target PHP Class to change its concrete implementation</font></td>
33+
</tr>
34+
<tr>
35+
<td valign="top"><nobr><font face="verdana" size="-2"><b>${TYPE}</b></font></nobr></td>
36+
<td width="10">&nbsp;</td>
37+
<td width="100%" valign="top"><font face="verdana" size="-1">PHP Class that will be instantiated instead of specified in predefined ${FOR} variable</font></td>
38+
</tr>
39+
</table>
940
</body>
10-
</html>
41+
</html>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<event name="${EVENT_NAME}">
2+
<observer name="${OBSERVER_NAME}" instance="${OBSERVER_CLASS}" />
3+
</event>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!--
2+
/*
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<html>
8+
<body>
9+
</body>
10+
</html>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* Observer for ${EVENT_NAME}
3+
*
4+
* @param Observer $observer
5+
* @return void
6+
*/
7+
public function execute(Observer $observer)
8+
{
9+
$event = $observer->getEvent();
10+
// TODO: Implement observer method.
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!--
2+
/*
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<html>
8+
<body>
9+
</body>
10+
</html>

0 commit comments

Comments
 (0)